├── .github └── workflows │ └── main.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── Makefile ├── README.md ├── dist.sh ├── res ├── fonts │ ├── asot.ttf │ ├── extra │ │ ├── arborcrest.ttf │ │ ├── arial.ttf │ │ ├── atarcc.ttf │ │ ├── atarcce.ttf │ │ └── atarcs.ttf │ └── font.ttf ├── gfx │ ├── about.png │ ├── keypad_large.png │ ├── keypad_med.png │ ├── keypad_small.png │ └── layers │ │ └── wiicolem.png ├── icon.png ├── layout │ ├── apps │ │ └── wiicolem │ │ │ ├── README.wii │ │ │ ├── icon.png │ │ │ └── meta.xml │ └── wiicolem │ │ ├── COLECO.ROM │ │ ├── COLECO_NODELAY.ROM │ │ ├── overlays │ │ ├── 2001.png │ │ ├── apshai.png │ │ ├── apshai2.png │ │ ├── aquaattack.png │ │ ├── boulderdash.png │ │ ├── cpkps.png │ │ ├── dambusters.png │ │ ├── drseuss.png │ │ ├── facemaker.png │ │ ├── fortunebuilder.png │ │ ├── frontline.png │ │ ├── kenuston.png │ │ ├── miner.png │ │ ├── mousetrap.png │ │ ├── rocky.png │ │ ├── roo.png │ │ ├── roo2.png │ │ ├── sabb.png │ │ ├── safb.png │ │ ├── spnpw.png │ │ ├── spyhunter.png │ │ ├── startrek.png │ │ ├── wargames.png │ │ └── warroom.png │ │ ├── roms │ │ └── .gitignore │ │ ├── saves │ │ └── .gitignore │ │ ├── states │ │ └── .gitignore │ │ ├── wiicolem.conf │ │ └── wiicolem.db └── overlays │ ├── 2001 │ ├── 2001-source.png │ └── info.txt │ ├── _final │ ├── 2001.png │ ├── apshai.png │ ├── apshai2.png │ ├── aquaattack.png │ ├── boulderdash.png │ ├── cpkps.png │ ├── dambusters.png │ ├── drseuss.png │ ├── facemaker.png │ ├── fortunebuilder.png │ ├── frontline.png │ ├── kenuston.png │ ├── miner.png │ ├── mousetrap.png │ ├── rocky.png │ ├── roo.png │ ├── roo2.png │ ├── sabb.png │ ├── safb.png │ ├── spnpw.png │ ├── spyhunter.png │ ├── startrek.png │ ├── wargames.png │ └── warroom.png │ ├── apshai │ ├── apshai.png │ ├── apshai2.png │ ├── info.txt │ └── info2.txt │ ├── aquaattack │ ├── aquaattack.png │ └── info.txt │ ├── boulderdash │ ├── boulderdash.png │ └── info.txt │ ├── cpkps │ ├── cpkps-source.png │ └── info.txt │ ├── dambusters │ ├── dambusters.png │ └── info.txt │ ├── default │ ├── default-large-source.png │ ├── default-med-source.png │ ├── default-small-source.png │ ├── info-large.txt │ ├── info-med.txt │ └── info-small.txt │ ├── drseuss │ ├── drseuss.png │ └── info.txt │ ├── facemaker │ ├── facemaker.png │ └── info.txt │ ├── fortune builder │ ├── fortunebuilder.png │ └── info.txt │ ├── frontline │ ├── frontline.png │ └── info.txt │ ├── kenuston │ ├── info.txt │ └── kenuston.png │ ├── miner │ ├── info.txt │ └── miner.png │ ├── mousetrap │ ├── info.txt │ └── mousetrap.png │ ├── rocky │ ├── info.txt │ └── rocky.png │ ├── roo │ ├── info.txt │ ├── info2.txt │ ├── roo.png │ └── roo2.png │ ├── sabb │ ├── info.txt │ └── sabb.png │ ├── safb │ ├── info.txt │ └── safb.png │ ├── spnpw │ ├── info.txt │ └── spnpw.png │ ├── spy hunter │ ├── info.txt │ └── spyhunter.png │ ├── startrek │ ├── info.txt │ └── startrek.png │ ├── war room │ ├── info.txt │ └── warroom.png │ └── wargames │ ├── info.txt │ └── wargames-source.png └── src ├── ColEm ├── AdamNet.c ├── AdamNet.h ├── ColEm.c ├── ColEm.html ├── Coleco.c ├── Coleco.h ├── Display.h ├── Help.h ├── Menu.c ├── State.h └── Wii │ ├── WiiColem.cpp │ └── wii_types.h ├── EMULib ├── AY8910.c ├── AY8910.h ├── C24XX.c ├── C24XX.h ├── CRC32.c ├── CRC32.h ├── Console.h ├── ConsoleMux.h ├── DRV9918.c ├── EMULib.c ├── EMULib.h ├── Hunt.c ├── Hunt.h ├── ImageMux.h ├── MIDIFreq.h ├── Record.c ├── Record.h ├── SN76489.c ├── SN76489.h ├── Sound.c ├── Sound.h ├── TMS9918.c ├── TMS9918.h └── Wii │ ├── LibWii.h │ └── SndSDL.c ├── Z80 ├── Codes.h ├── CodesCB.h ├── CodesED.h ├── CodesXCB.h ├── CodesXX.h ├── ConDebug.c ├── Debug.c ├── Tables.h ├── Z80.c └── Z80.h └── wii ├── wii_app_common.h ├── wii_coleco.cpp ├── wii_coleco.h ├── wii_coleco_config.cpp ├── wii_coleco_db.cpp ├── wii_coleco_db.h ├── wii_coleco_emulation.cpp ├── wii_coleco_emulation.h ├── wii_coleco_keypad.cpp ├── wii_coleco_keypad.h ├── wii_coleco_menu.cpp ├── wii_coleco_menu.h ├── wii_coleco_sdl.cpp ├── wii_coleco_snapshot.cpp └── wii_coleco_snapshot.h /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | 8 | runs-on: ubuntu-latest 9 | 10 | steps: 11 | - uses: actions/checkout@v1 12 | with: 13 | submodules: recursive 14 | - run: docker run raz0red/devkitppc /opt/devkitpro/pacman/bin/pacman -Q 15 | - run: docker run -v $(pwd):/source raz0red/devkitppc /source/dist.sh /tmp/wiicolem 16 | - uses: actions/upload-artifact@v1 17 | with: 18 | name: dist 19 | path: dist 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | dist 3 | boot.* 4 | settings.json 5 | *.ncb 6 | *.sln 7 | *.suo 8 | *.vcproj* 9 | c_cpp_properties.* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "wii-emucommon"] 2 | path = wii-emucommon 3 | url = https://github.com/raz0red/wii-emucommon.git 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The license for ColEm as indicated by Marat Fayzullin, the author of ColEm is detailed below: 2 | 3 | ColEm sources are available under three conditions: 4 | 5 | 1) You are not using them for a commercial project. 6 | 2) You provide a proper reference to Marat Fayzullin as the author of the original source code. 7 | 3) You provide a link to http://fms.komkon.org/ColEm/ 8 | -------------------------------------------------------------------------------- /dist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | #---------------------------------------------------------------------------# 4 | # __ __.__.___________ .__ # 5 | # / \ / \__|__\_ ___ \ ____ | | ____ _____ # 6 | # \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ # 7 | # \ /| | \ \___( <_> ) |_\ ___/| Y Y \ # 8 | # \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / # 9 | # \/ \/ \/ \/ # 10 | # WiiColem by raz0red # 11 | # Port of the ColEm emulator by Marat Fayzullin # 12 | # # 13 | # [github.com/raz0red/wiicolem] # 14 | # # 15 | #---------------------------------------------------------------------------# 16 | # # 17 | # Copyright (C) 2019 raz0red # 18 | # # 19 | # The license for ColEm as indicated by Marat Fayzullin, the author of # 20 | # ColEm is detailed below: # 21 | # # 22 | # ColEm sources are available under three conditions: # 23 | # # 24 | # 1) You are not using them for a commercial project. # 25 | # 2) You provide a proper reference to Marat Fayzullin as the author of # 26 | # the original source code. # 27 | # 3) You provide a link to http://fms.komkon.org/ColEm/ # 28 | # # 29 | #---------------------------------------------------------------------------# 30 | 31 | SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" 32 | DATE="$( date '+%Y%m%d%H%S' )" 33 | DIST_DIR=$SCRIPTPATH/dist 34 | LAYOUT_DIR=$SCRIPTPATH/res/layout/ 35 | BOOT_DOL_SRC=$SCRIPTPATH/boot.dol 36 | BOOT_DOL_DEST=$DIST_DIR/apps/wiicolem 37 | BOOT_ELF_SRC=$SCRIPTPATH/boot.elf 38 | BOOT_ELF_DEST=$DIST_DIR 39 | META_FILE=$DIST_DIR/apps/wiicolem/meta.xml 40 | EMUCOMMON_DIR=$SCRIPTPATH/wii-emucommon 41 | 42 | # 43 | # Function that is invoked when the script fails. 44 | # 45 | # $1 - The message to display prior to exiting. 46 | # 47 | function fail() { 48 | echo $1 49 | echo "Exiting." 50 | exit 1 51 | } 52 | 53 | # 54 | # Build in directory specified (if applicable) 55 | # 56 | if [ ! -z $1 ]; then 57 | BUILD_DIR=$1 58 | echo "Building in: $BUILD_DIR..." 59 | rm -rf $BUILD_DIR \ 60 | || { fail 'Unable to delete build directory.'; } 61 | cp -R $SCRIPTPATH $BUILD_DIR \ 62 | || { fail 'Unable to copy files to build directory.'; } 63 | find $BUILD_DIR -type f \ 64 | \( -name "*.o" -or -name "*.a" -or -name "*.dol" -or -name "*.elf" \) \ 65 | -exec rm {} + \ 66 | || { fail 'Unable to delete previous build output files.'; } 67 | $BUILD_DIR/dist.sh \ 68 | || { fail 'Error running dist script.'; } 69 | rm -rf $DIST_DIR \ 70 | || { fail 'Unable to remove dist directory.'; } 71 | cp -R $BUILD_DIR/dist $DIST_DIR \ 72 | || { fail 'Unable to copy files to final dist directory.'; } 73 | exit 0 74 | fi 75 | 76 | # Build wii-emucommon 77 | echo "Building wii-emucommon..." 78 | $EMUCOMMON_DIR/dist.sh || { fail 'Error building wii-emucommon.'; } 79 | 80 | # Change to script directory 81 | echo "Changing to script directory..." 82 | cd $SCRIPTPATH || { fail 'Error changing to script directory.'; } 83 | 84 | # Build WiiColem 85 | echo "Building WiiColem..." 86 | make || { fail 'Error building WiiColem.'; } 87 | 88 | # Clear dist directory 89 | if [ -d $DIST_DIR ]; then 90 | echo "Clearing dist directory..." 91 | rm -rf $DIST_DIR || { fail 'Error clearing dist directory.'; } 92 | fi 93 | 94 | # Copy layout 95 | echo "Copy layout..." 96 | cp -R $LAYOUT_DIR $DIST_DIR || { fail 'Error copying layout.'; } 97 | 98 | # Remove .gitignore 99 | echo "Cleaning layout..." 100 | find $DIST_DIR -name .gitignore -type f -delete \ 101 | || { fail 'Error cleaning layout.'; } 102 | 103 | # Copy boot files 104 | echo "Copying boot files..." 105 | cp $BOOT_DOL_SRC $BOOT_DOL_DEST || { fail 'Error copying boot.dol.'; } 106 | 107 | # Update date in meta file 108 | echo "Setting date in meta file..." 109 | sed -i "s,000000000000,$DATE,g" $META_FILE \ 110 | || { fail 'Error setting date in meta file.'; } 111 | 112 | # Update version in meta-file (if SNAPSHOT) 113 | echo "Updating version in meta file..." 114 | sed -i "s,-SNAPSHOT,-SNAPSHOT-$DATE,g" $META_FILE \ 115 | || { fail 'Error setting version in meta file.'; } 116 | 117 | # Create the distribution (zip) 118 | echo "Creating distribution..." 119 | VERSION=$( sed -ne "s/.*version>\(.*\)<\/version.*/\1/p" $META_FILE ) 120 | VERSION_NO_DOTS="${VERSION//./_}" 121 | DIST_FILE=wiicolem-$VERSION_NO_DOTS.zip 122 | cd $DIST_DIR || { fail 'Error changing to distribution directory.'; } 123 | zip -r $DIST_FILE . || { fail 'Error creating zip file.'; } 124 | rm -rf $DIST_DIR/wiicolem \ 125 | || { fail 'Error deleting wiicolem directory in dist.'; } 126 | rm -rf $DIST_DIR/apps \ 127 | || { fail 'Error deleting apps directory in dist.'; } 128 | cp $BOOT_ELF_SRC $BOOT_ELF_DEST || { fail 'Error copying boot.elf.'; } 129 | -------------------------------------------------------------------------------- /res/fonts/asot.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/asot.ttf -------------------------------------------------------------------------------- /res/fonts/extra/arborcrest.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/extra/arborcrest.ttf -------------------------------------------------------------------------------- /res/fonts/extra/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/extra/arial.ttf -------------------------------------------------------------------------------- /res/fonts/extra/atarcc.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/extra/atarcc.ttf -------------------------------------------------------------------------------- /res/fonts/extra/atarcce.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/extra/atarcce.ttf -------------------------------------------------------------------------------- /res/fonts/extra/atarcs.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/extra/atarcs.ttf -------------------------------------------------------------------------------- /res/fonts/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/fonts/font.ttf -------------------------------------------------------------------------------- /res/gfx/about.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/gfx/about.png -------------------------------------------------------------------------------- /res/gfx/keypad_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/gfx/keypad_large.png -------------------------------------------------------------------------------- /res/gfx/keypad_med.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/gfx/keypad_med.png -------------------------------------------------------------------------------- /res/gfx/keypad_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/gfx/keypad_small.png -------------------------------------------------------------------------------- /res/gfx/layers/wiicolem.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/gfx/layers/wiicolem.png -------------------------------------------------------------------------------- /res/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/icon.png -------------------------------------------------------------------------------- /res/layout/apps/wiicolem/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/apps/wiicolem/icon.png -------------------------------------------------------------------------------- /res/layout/apps/wiicolem/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | WiiColEm 4 | raz0red 5 | 0.4-SNAPSHOT 6 | 000000000000 7 | ColecoVision Emulator 8 | WiiColem is a port of the ColEm emulator developed by Marat Fayzullin. 9 | 10 | Wii port by raz0red [http://github.com/raz0red]. 11 | 12 | 13 | -------------------------------------------------------------------------------- /res/layout/wiicolem/COLECO.ROM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/COLECO.ROM -------------------------------------------------------------------------------- /res/layout/wiicolem/COLECO_NODELAY.ROM: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/COLECO_NODELAY.ROM -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/2001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/2001.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/apshai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/apshai.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/apshai2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/apshai2.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/aquaattack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/aquaattack.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/boulderdash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/boulderdash.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/cpkps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/cpkps.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/dambusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/dambusters.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/drseuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/drseuss.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/facemaker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/facemaker.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/fortunebuilder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/fortunebuilder.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/frontline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/frontline.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/kenuston.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/kenuston.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/miner.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/mousetrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/mousetrap.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/rocky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/rocky.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/roo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/roo.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/roo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/roo2.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/sabb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/sabb.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/safb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/safb.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/spnpw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/spnpw.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/spyhunter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/spyhunter.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/startrek.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/startrek.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/wargames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/wargames.png -------------------------------------------------------------------------------- /res/layout/wiicolem/overlays/warroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/overlays/warroom.png -------------------------------------------------------------------------------- /res/layout/wiicolem/roms/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/roms/.gitignore -------------------------------------------------------------------------------- /res/layout/wiicolem/saves/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/saves/.gitignore -------------------------------------------------------------------------------- /res/layout/wiicolem/states/.gitignore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/states/.gitignore -------------------------------------------------------------------------------- /res/layout/wiicolem/wiicolem.conf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/layout/wiicolem/wiicolem.conf -------------------------------------------------------------------------------- /res/overlays/2001/2001-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/2001/2001-source.png -------------------------------------------------------------------------------- /res/overlays/2001/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=2001.png 2 | keypSelKeyRgba=FFFFFF40 3 | keypSelKeyW=45 4 | keypSelKeyH=40 5 | keypOffX=26 6 | keypOffY=27 7 | keypGapX=5 8 | keypGapY=12 -------------------------------------------------------------------------------- /res/overlays/_final/2001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/2001.png -------------------------------------------------------------------------------- /res/overlays/_final/apshai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/apshai.png -------------------------------------------------------------------------------- /res/overlays/_final/apshai2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/apshai2.png -------------------------------------------------------------------------------- /res/overlays/_final/aquaattack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/aquaattack.png -------------------------------------------------------------------------------- /res/overlays/_final/boulderdash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/boulderdash.png -------------------------------------------------------------------------------- /res/overlays/_final/cpkps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/cpkps.png -------------------------------------------------------------------------------- /res/overlays/_final/dambusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/dambusters.png -------------------------------------------------------------------------------- /res/overlays/_final/drseuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/drseuss.png -------------------------------------------------------------------------------- /res/overlays/_final/facemaker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/facemaker.png -------------------------------------------------------------------------------- /res/overlays/_final/fortunebuilder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/fortunebuilder.png -------------------------------------------------------------------------------- /res/overlays/_final/frontline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/frontline.png -------------------------------------------------------------------------------- /res/overlays/_final/kenuston.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/kenuston.png -------------------------------------------------------------------------------- /res/overlays/_final/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/miner.png -------------------------------------------------------------------------------- /res/overlays/_final/mousetrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/mousetrap.png -------------------------------------------------------------------------------- /res/overlays/_final/rocky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/rocky.png -------------------------------------------------------------------------------- /res/overlays/_final/roo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/roo.png -------------------------------------------------------------------------------- /res/overlays/_final/roo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/roo2.png -------------------------------------------------------------------------------- /res/overlays/_final/sabb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/sabb.png -------------------------------------------------------------------------------- /res/overlays/_final/safb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/safb.png -------------------------------------------------------------------------------- /res/overlays/_final/spnpw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/spnpw.png -------------------------------------------------------------------------------- /res/overlays/_final/spyhunter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/spyhunter.png -------------------------------------------------------------------------------- /res/overlays/_final/startrek.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/startrek.png -------------------------------------------------------------------------------- /res/overlays/_final/wargames.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/wargames.png -------------------------------------------------------------------------------- /res/overlays/_final/warroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/_final/warroom.png -------------------------------------------------------------------------------- /res/overlays/apshai/apshai.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/apshai/apshai.png -------------------------------------------------------------------------------- /res/overlays/apshai/apshai2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/apshai/apshai2.png -------------------------------------------------------------------------------- /res/overlays/apshai/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=apshai.png 2 | keypSelKeyRgba=0000005B 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=23 6 | keypOffY=22 7 | keypGapX=6 8 | keypGapY=12 -------------------------------------------------------------------------------- /res/overlays/apshai/info2.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=apshai2.png 2 | keypSelKeyRgba=FFFFFF6D 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=22 6 | keypOffY=23 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/aquaattack/aquaattack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/aquaattack/aquaattack.png -------------------------------------------------------------------------------- /res/overlays/aquaattack/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=aquaattack.png 2 | keypSelKeyRgba=FF00007F 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=23 6 | keypOffY=24 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/boulderdash/boulderdash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/boulderdash/boulderdash.png -------------------------------------------------------------------------------- /res/overlays/boulderdash/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=boulderdash.png 2 | keypSelKeyRgba=66666699 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=21 6 | keypOffY=25 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/cpkps/cpkps-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/cpkps/cpkps-source.png -------------------------------------------------------------------------------- /res/overlays/cpkps/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=cpkps.png 2 | keypSelKeyRgba=FFFFFF5E 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=22 6 | keypOffY=23 7 | keypGapX=9 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/dambusters/dambusters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/dambusters/dambusters.png -------------------------------------------------------------------------------- /res/overlays/dambusters/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=dambusters.png 2 | keypSelKeyRgba=0000665B 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=20 6 | keypOffY=22 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/default/default-large-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/default/default-large-source.png -------------------------------------------------------------------------------- /res/overlays/default/default-med-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/default/default-med-source.png -------------------------------------------------------------------------------- /res/overlays/default/default-small-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/default/default-small-source.png -------------------------------------------------------------------------------- /res/overlays/default/info-large.txt: -------------------------------------------------------------------------------- 1 | OffsetX=27 2 | OffsetY=126 3 | GapX=6 4 | GapY=5 5 | Width=21 6 | Height=20 7 | Color=00FF0080 -------------------------------------------------------------------------------- /res/overlays/default/info-med.txt: -------------------------------------------------------------------------------- 1 | OffsetX=25 2 | OffsetY=104 3 | GapX=4 4 | GapY=5 5 | Width=18 6 | Height=16 7 | Color=00FF0080 8 | 112x212 -------------------------------------------------------------------------------- /res/overlays/default/info-small.txt: -------------------------------------------------------------------------------- 1 | OffsetX=23 2 | OffsetY=80 3 | GapX=5 4 | GapY=5 5 | Width=12 6 | Height=11 7 | Color=00FF0080 -------------------------------------------------------------------------------- /res/overlays/drseuss/drseuss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/drseuss/drseuss.png -------------------------------------------------------------------------------- /res/overlays/drseuss/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=drseuss.png 2 | keypSelKeyRgba=00000056 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=20 6 | keypOffY=22 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/facemaker/facemaker.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/facemaker/facemaker.png -------------------------------------------------------------------------------- /res/overlays/facemaker/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=facemaker.png 2 | keypSelKeyRgba=00000056 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=25 6 | keypOffY=22 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/fortune builder/fortunebuilder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/fortune builder/fortunebuilder.png -------------------------------------------------------------------------------- /res/overlays/fortune builder/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=fortunebuilder.png 2 | keypSelKeyRgba=D2000063 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=23 6 | keypOffY=21 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/frontline/frontline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/frontline/frontline.png -------------------------------------------------------------------------------- /res/overlays/frontline/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=frontline.png 2 | keypSelKeyRgba=0000FF54 3 | keypSelKeyW=35 4 | keypSelKeyH=25 5 | keypOffX=94 6 | keypOffY=38 7 | keypGapX=8 8 | keypGapY=17 -------------------------------------------------------------------------------- /res/overlays/kenuston/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=kenuston.png 2 | keypSelKeyRgba=FF000063 3 | keypSelKeyW=45 4 | keypSelKeyH=42 5 | keypOffX=19 6 | keypOffY=24 7 | keypGapX=6 8 | keypGapY=10 -------------------------------------------------------------------------------- /res/overlays/kenuston/kenuston.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/kenuston/kenuston.png -------------------------------------------------------------------------------- /res/overlays/miner/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=miner.png 2 | keypSelKeyRgba=0000005B 3 | keypSelKeyW=45 4 | keypSelKeyH=42 5 | keypOffX=24 6 | keypOffY=22 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/miner/miner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/miner/miner.png -------------------------------------------------------------------------------- /res/overlays/mousetrap/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=mousetrap.png 2 | keypSelKeyRgba=3333CC63 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=22 6 | keypOffY=21 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/mousetrap/mousetrap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/mousetrap/mousetrap.png -------------------------------------------------------------------------------- /res/overlays/rocky/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=rocky.png 2 | keypSelKeyRgba=FF000054 3 | keypSelKeyW=35 4 | keypSelKeyH=25 5 | keypOffX=94 6 | keypOffY=38 7 | keypGapX=8 8 | keypGapY=17 -------------------------------------------------------------------------------- /res/overlays/rocky/rocky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/rocky/rocky.png -------------------------------------------------------------------------------- /res/overlays/roo/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=roo.png 2 | keypSelKeyRgba=0000005B 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=24 6 | keypOffY=23 7 | keypGapX=6 8 | keypGapY=12 -------------------------------------------------------------------------------- /res/overlays/roo/info2.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=roo2.png 2 | keypSelKeyRgba=0000006D 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=26 6 | keypOffY=23 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/roo/roo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/roo/roo.png -------------------------------------------------------------------------------- /res/overlays/roo/roo2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/roo/roo2.png -------------------------------------------------------------------------------- /res/overlays/sabb/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=sabb.png 2 | keypSelKeyRgba=0000FF54 3 | keypSelKeyW=35 4 | keypSelKeyH=25 5 | keypOffX=93 6 | keypOffY=38 7 | keypGapX=9 8 | keypGapY=17 -------------------------------------------------------------------------------- /res/overlays/sabb/sabb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/sabb/sabb.png -------------------------------------------------------------------------------- /res/overlays/safb/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=sabb.png 2 | keypSelKeyRgba=0000FF54 3 | keypSelKeyW=35 4 | keypSelKeyH=25 5 | keypOffX=93 6 | keypOffY=38 7 | keypGapX=9 8 | keypGapY=17 -------------------------------------------------------------------------------- /res/overlays/safb/safb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/safb/safb.png -------------------------------------------------------------------------------- /res/overlays/spnpw/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=spnpw.png 2 | keypSelKeyRgba=FFFFFF5E 3 | keypSelKeyW=45 4 | keypSelKeyH=45 5 | keypOffX=20 6 | keypOffY=21 7 | keypGapX=9 8 | keypGapY=8 -------------------------------------------------------------------------------- /res/overlays/spnpw/spnpw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/spnpw/spnpw.png -------------------------------------------------------------------------------- /res/overlays/spy hunter/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=spyhunter.png 2 | keypSelKeyRgba=FFFFFF54 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=23 6 | keypOffY=20 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/spy hunter/spyhunter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/spy hunter/spyhunter.png -------------------------------------------------------------------------------- /res/overlays/startrek/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=startrek.png 2 | keypSelKeyRgba=FF000054 3 | keypSelKeyW=35 4 | keypSelKeyH=25 5 | keypOffX=93 6 | keypOffY=40 7 | keypGapX=8 8 | keypGapY=17 -------------------------------------------------------------------------------- /res/overlays/startrek/startrek.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/startrek/startrek.png -------------------------------------------------------------------------------- /res/overlays/war room/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=warroom.png 2 | keypSelKeyRgba=FFFFFF56 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=26 6 | keypOffY=23 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/war room/warroom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/war room/warroom.png -------------------------------------------------------------------------------- /res/overlays/wargames/info.txt: -------------------------------------------------------------------------------- 1 | keypOverlay=cpkps.png 2 | keypSelKeyRgba=FFFFFF4F 3 | keypSelKeyW=45 4 | keypSelKeyH=41 5 | keypOffX=19 6 | keypOffY=23 7 | keypGapX=6 8 | keypGapY=11 -------------------------------------------------------------------------------- /res/overlays/wargames/wargames-source.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/raz0red/wiicolem/d762fe86cee8ba3866b88e4d017ab1862fd4acef/res/overlays/wargames/wargames-source.png -------------------------------------------------------------------------------- /src/ColEm/AdamNet.c: -------------------------------------------------------------------------------- 1 | /** ColEm: portable Coleco emulator **************************/ 2 | /** **/ 3 | /** AdamNet.c **/ 4 | /** **/ 5 | /** This file contains implementation for the AdamNet I/O **/ 6 | /** interface found in Coleco Adam home computer. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #include "AdamNet.h" 14 | #include 15 | #include 16 | 17 | #ifdef ANDROID 18 | #include "EMULib.h" 19 | #define puts LOGI 20 | #define printf LOGI 21 | #endif 22 | 23 | static word PCBAddr; 24 | byte PCBTable[0x10000]; 25 | static byte DiskID; 26 | static byte KBDStatus; 27 | 28 | extern byte *ROMPage[8]; /* 8x8kB read-only (ROM) pages */ 29 | extern byte *RAMPage[8]; /* 8x8kB read-write (RAM) pages */ 30 | extern byte Port60; 31 | extern int Verbose; 32 | 33 | /** GetPCB() *************************************************/ 34 | /** Get PCB byte at given offset. **/ 35 | /*************************************************************/ 36 | static byte GetPCB(byte Offset) 37 | { 38 | word A = (PCBAddr+Offset)&0xFFFF; 39 | return(ROMPage[A>>13][A&0x1FFF]); 40 | } 41 | 42 | /** SetPCB() *************************************************/ 43 | /** Set PCB byte at given offset. **/ 44 | /*************************************************************/ 45 | static void SetPCB(byte Offset,byte Value) 46 | { 47 | word A = (PCBAddr+Offset)&0xFFFF; 48 | RAMPage[A>>13][A&0x1FFF] = Value; 49 | } 50 | 51 | /** IsPCB() **************************************************/ 52 | /** Return 1 if given address belongs to PCB, 0 otherwise. **/ 53 | /*************************************************************/ 54 | static int IsPCB(word A) 55 | { 56 | /* Quick check for PCB presence */ 57 | if(!PCBTable[A]) return(0); 58 | 59 | /* Check if PCB is mapped in */ 60 | if((A<0x2000) && ((Port60&0x03)!=1)) return(0); 61 | if((A<0x8000) && ((Port60&0x03)!=1) && ((Port60&0x03)!=3)) return(0); 62 | if((A>=0x8000) && (Port60&0x0C)) return(0); 63 | 64 | /* Check number of active devices */ 65 | if(A>=PCBAddr+GetPCB(3)*21+4) return(0); 66 | 67 | /* This address belongs to AdamNet */ 68 | return(1); 69 | } 70 | 71 | /** MovePCB() ************************************************/ 72 | /** Move PCB and related DCBs to a new address. **/ 73 | /*************************************************************/ 74 | static void MovePCB(word NewAddr) 75 | { 76 | int J; 77 | 78 | PCBTable[PCBAddr] = 0; 79 | PCBTable[NewAddr] = 1; 80 | 81 | for(J=4;J<4+15*21;J+=21) 82 | { 83 | PCBTable[(PCBAddr+J)&0xFFFF] = 0; 84 | PCBTable[(NewAddr+J)&0xFFFF] = 1; 85 | } 86 | printf("PCB 0x%04X => 0x%04X\n",PCBAddr,NewAddr); 87 | PCBAddr = NewAddr; 88 | SetPCB(3,15); 89 | } 90 | 91 | static byte GetKBD() 92 | { 93 | static int Cnt = 3; 94 | static byte Chr = 'K'; 95 | 96 | if(Cnt) { --Cnt;return(Chr); } else return(0); 97 | } 98 | 99 | static void UpdateKBD(word Addr,int V) 100 | { 101 | word Buf; 102 | int J,Count; 103 | 104 | printf("KBD[%02Xh] = %02X\n",Addr,V); 105 | 106 | switch(V) 107 | { 108 | case -1: 109 | SetPCB(Addr,KBDStatus); 110 | break; 111 | case 1: 112 | case 2: 113 | SetPCB(Addr,KBDStatus=0x80); 114 | break; 115 | case 3: 116 | SetPCB(Addr,0x9B); 117 | KBDStatus = 0x80; 118 | break; 119 | case 4: 120 | Buf = GetPCB(Addr+1) + ((word)GetPCB(Addr+2)<<8); 121 | Count = GetPCB(Addr+3) + ((word)GetPCB(Addr+4)<<8); 122 | KBDStatus = 0x80; 123 | SetPCB(Addr,0); 124 | for(J=0;J>13][Buf&0x1FFF] = V==255? 0:V; 128 | else { KBDStatus = 0x8C;break; } 129 | } 130 | break; 131 | } 132 | } 133 | 134 | static void UpdatePRN(word Addr,int V) 135 | { 136 | if(V>=0) SetPCB(Addr,V|0x80); 137 | } 138 | 139 | static void UpdateDSK(byte DevID,word Addr,int V) 140 | { 141 | if(V>=0) SetPCB(Addr,V|0x80); 142 | } 143 | 144 | static void UpdateTAP(byte DevID,word Addr,int V) 145 | { 146 | if(V>=0) SetPCB(Addr,V|0x80); 147 | } 148 | 149 | static void UpdatePCB(word Addr,int V) 150 | { 151 | //if(Addr!=0xFEC4) 152 | //if(V>=0) printf("PCB[%04Xh] <= %02Xh\n",Addr,V); 153 | //else printf("PCB[%04Xh] => %02Xh\n",Addr,GetPCB(Addr-PCBAddr)); 154 | 155 | // if(Addr==PCBAddr+3) SetPCB(3,15); 156 | if((Addr==PCBAddr+4)&&(V>=0)) SetPCB(4,V|0x80); 157 | 158 | if((Addr!=PCBAddr)||(V<0)) return; 159 | 160 | switch(V) 161 | { 162 | case 1: /* Sync Z80 */ 163 | SetPCB(0,0x80|V); 164 | break; 165 | case 2: /* Sync master 6801 */ 166 | SetPCB(0,0x80|V); 167 | break; 168 | case 3: /* Relocate PCB */ 169 | SetPCB(0,0x80|V); 170 | MovePCB(GetPCB(1)+((word)GetPCB(2)<<8)); 171 | break; 172 | default: 173 | if(V && (V<0x80) && (Verbose&0x100)) 174 | printf("AdamNet: Unimplemented PCB operation %02Xh\n",V); 175 | break; 176 | } 177 | } 178 | 179 | static void UpdateDCB(word Addr,int V) 180 | { 181 | word Base; 182 | byte DevID; 183 | 184 | /* When writing, ignore invalid commands */ 185 | if(!V || (V>=0x80)) return; 186 | 187 | /* Compute device ID, offset inside PCB */ 188 | Base = 21*((Addr-PCBAddr)/21); 189 | DevID = (GetPCB(Base+9)<<4) + (GetPCB(Base+16)&0x0F); 190 | Addr = Addr - PCBAddr; 191 | 192 | printf("DCB #%d at %04Xh = %02Xh\n",DevID,Addr,V); 193 | 194 | /* Depending on the device ID... */ 195 | switch(DevID) 196 | { 197 | case 0x01: UpdateKBD(Addr,V);break; 198 | case 0x02: UpdatePRN(Addr,V);break; 199 | case 0x04: 200 | case 0x05: 201 | case 0x06: 202 | case 0x07: UpdateDSK(DiskID=DevID-4,Addr,V);break; 203 | case 0x08: 204 | case 0x09: 205 | case 0x18: 206 | case 0x19: UpdateTAP((DevID>>4)+((DevID&1)<<1),Addr,V);break; 207 | case 0x52: UpdateDSK(DiskID,Addr,-2);break; 208 | 209 | default: 210 | SetPCB(Addr,0x9B); 211 | if(Verbose&0x100) 212 | printf("AdamNet: %s unknown device #%d\n",V>=0? "Write to":"Read from",DevID); 213 | break; 214 | } 215 | } 216 | 217 | /** ReadPCB() ************************************************/ 218 | /** Read value from a given PCB or DCB address. **/ 219 | /*************************************************************/ 220 | void ReadPCB(word A) 221 | { 222 | if(IsPCB(A)) { if(A 19 | #include 20 | #include 21 | #include 22 | 23 | char *Options[]= 24 | { 25 | "verbose","pal","ntsc","skip","help", 26 | "adam","cv","sgm","nosgm","24c08","24c256","sram", 27 | "allspr","autoa","noautoa","autob","noautob", 28 | "spin1x","spin1y","spin2x","spin2y", 29 | "drums","nodrums","logsnd","palette", 30 | "home","sound","nosound","trap", 31 | "sync","nosync","scale","vsync", 32 | 0 33 | }; 34 | 35 | extern const char *Title;/* Program title */ 36 | extern int UseSound; /* Sound mode */ 37 | extern int UseZoom; /* Scaling factor (UNIX) */ 38 | extern int UseEffects; /* EFF_* bits (UNIX/MSDOS) */ 39 | extern int SyncFreq; /* Sync screen updates (UNIX/MSDOS) */ 40 | 41 | /** main() ***************************************************/ 42 | /** This is a main() function used in Unix and MSDOS ports. **/ 43 | /** It parses command line arguments, sets emulation **/ 44 | /** parameters, and passes control to the emulation itself. **/ 45 | /*************************************************************/ 46 | int main(int argc,char *argv[]) 47 | { 48 | char *CartName="CART.ROM"; 49 | char *P; 50 | int N,J,I; 51 | 52 | #if defined(DEBUG) 53 | CPU.Trap=0xFFFF; 54 | CPU.Trace=0; 55 | #endif 56 | 57 | #if defined(MSDOS) 58 | Verbose=0; 59 | #else 60 | Verbose=5; 61 | #endif 62 | 63 | /* Set home directory to where executable is */ 64 | #if defined(MSDOS) || defined(WINDOWS) 65 | P=strrchr(argv[0],'\\'); 66 | #else 67 | P=strrchr(argv[0],'/'); 68 | #endif 69 | if(P) { *P='\0';HomeDir=argv[0]; } 70 | 71 | #if defined(UNIX) || defined(MAEMO) || defined(MSDOS) 72 | /* Extract visual effects arguments */ 73 | UseEffects = ParseEffects(argv,UseEffects); 74 | #endif 75 | 76 | for(N=1,I=0;(N=argc) 97 | printf("%s: No skipped frames percentage supplied\n",argv[0]); 98 | else 99 | { 100 | J=atoi(argv[N]); 101 | if((J>=0)&&(J<=99)) UPeriod=100-J; 102 | } 103 | break; 104 | case 4: printf 105 | ("%s by Marat Fayzullin (C)FMS 1994-2019\n",Title); 106 | for(J=0;HelpText[J];J++) puts(HelpText[J]); 107 | return(0); 108 | case 5: Mode|=CV_ADAM;break; 109 | case 6: Mode&=~CV_ADAM;break; 110 | case 7: Mode|=CV_SGM;break; 111 | case 8: Mode&=~CV_SGM;break; 112 | case 9: Mode=(Mode&~CV_EEPROM)|CV_24C08;break; 113 | case 10: Mode=(Mode&~CV_EEPROM)|CV_24C256;break; 114 | case 11: Mode|=CV_SRAM;break; 115 | case 12: Mode|=CV_ALLSPRITE;break; 116 | case 13: Mode|=CV_AUTOFIRER;break; 117 | case 14: Mode&=~CV_AUTOFIRER;break; 118 | case 15: Mode|=CV_AUTOFIREL;break; 119 | case 16: Mode&=~CV_AUTOFIREL;break; 120 | case 17: Mode|=CV_SPINNER1X;break; 121 | case 18: Mode|=CV_SPINNER1Y;break; 122 | case 19: Mode|=CV_SPINNER2X;break; 123 | case 20: Mode|=CV_SPINNER2Y;break; 124 | case 21: Mode|=CV_DRUMS;break; 125 | case 22: Mode&=~CV_DRUMS;break; 126 | case 23: N++; 127 | if(N=argc) 132 | printf("%s: No palette number supplied\n",argv[0]); 133 | else 134 | { 135 | J = atoi(argv[N]); 136 | J = J==1? CV_PALETTE1 137 | : J==2? CV_PALETTE2 138 | : CV_PALETTE0; 139 | Mode = (Mode&~CV_PALETTE)|J; 140 | } 141 | break; 142 | case 25: N++; 143 | if(N=argc) { UseSound=1;N--; } 148 | else if(sscanf(argv[N],"%d",&UseSound)!=1) 149 | { UseSound=1;N--; } 150 | break; 151 | case 27: UseSound=0;break; 152 | 153 | #if defined(DEBUG) 154 | case 28: N++; 155 | if(N>=argc) 156 | printf("%s: No trap address supplied\n",argv[0]); 157 | else 158 | if(!strcmp(argv[N],"now")) CPU.Trace=1; 159 | else sscanf(argv[N],"%hX",&CPU.Trap); 160 | break; 161 | #endif /* DEBUG */ 162 | 163 | #if defined(UNIX) || defined(MSDOS) || defined(MAEMO) 164 | case 29: N++; 165 | if(N=argc) { UseZoom=1;N--; } 174 | else if(sscanf(argv[N],"%d",&UseZoom)!=1) 175 | { UseZoom=1;N--; } 176 | break; 177 | #endif /* UNIX */ 178 | 179 | #if defined(MSDOS) 180 | case 32: SyncFreq=-1;break; 181 | #endif /* MSDOS */ 182 | 183 | default: printf("%s: Wrong option '%s'\n",argv[0],argv[N]); 184 | } 185 | } 186 | 187 | if(!InitMachine()) return(1); 188 | StartColeco(CartName); 189 | TrashColeco(); 190 | TrashMachine(); 191 | return(0); 192 | } 193 | -------------------------------------------------------------------------------- /src/ColEm/Display.h: -------------------------------------------------------------------------------- 1 | /** ColEm: portable Coleco emulator **************************/ 2 | /** **/ 3 | /** Display.h **/ 4 | /** **/ 5 | /** This file instantiates TMS9918 display drivers for all **/ 6 | /** supported screen depths. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2008-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef DISPLAY_H 14 | #define DISPLAY_H 15 | 16 | /** Screen9918[] *********************************************/ 17 | /** Pointer to the scanline refresh handlers and VDP table **/ 18 | /** address masks for the standard TMS9918 screen modes. **/ 19 | /*************************************************************/ 20 | extern struct 21 | { 22 | void (*LineHandler)(TMS9918 *VDP,byte Y); 23 | unsigned char R2,R3,R4,R5,R6,M2,M3,M4,M5; 24 | } Screen9918[4]; 25 | 26 | #define PIXEL_TYPE_DEFINED 27 | #undef BPP8 28 | #undef BPP16 29 | #undef BPP24 30 | #undef BPP32 31 | 32 | #define BPP8 33 | #define pixel unsigned char 34 | #define RefreshSprites RefreshSprites_8 35 | #define RefreshBorder RefreshBorder_8 36 | #define RefreshLine0 RefreshLine0_8 37 | #define RefreshLine1 RefreshLine1_8 38 | #define RefreshLine2 RefreshLine2_8 39 | #define RefreshLine3 RefreshLine3_8 40 | #include "DRV9918.c" 41 | #undef BPP8 42 | #undef pixel 43 | #undef RefreshSprites 44 | #undef RefreshBorder 45 | #undef RefreshLine0 46 | #undef RefreshLine1 47 | #undef RefreshLine2 48 | #undef RefreshLine3 49 | 50 | #define BPP16 51 | #define pixel unsigned short 52 | #define RefreshSprites RefreshSprites_16 53 | #define RefreshBorder RefreshBorder_16 54 | #define RefreshLine0 RefreshLine0_16 55 | #define RefreshLine1 RefreshLine1_16 56 | #define RefreshLine2 RefreshLine2_16 57 | #define RefreshLine3 RefreshLine3_16 58 | #include "DRV9918.c" 59 | #undef BPP16 60 | #undef pixel 61 | #undef RefreshSprites 62 | #undef RefreshBorder 63 | #undef RefreshLine0 64 | #undef RefreshLine1 65 | #undef RefreshLine2 66 | #undef RefreshLine3 67 | 68 | #define BPP32 69 | #define pixel unsigned int 70 | #define RefreshSprites RefreshSprites_32 71 | #define RefreshBorder RefreshBorder_32 72 | #define RefreshLine0 RefreshLine0_32 73 | #define RefreshLine1 RefreshLine1_32 74 | #define RefreshLine2 RefreshLine2_32 75 | #define RefreshLine3 RefreshLine3_32 76 | #include "DRV9918.c" 77 | #undef BPP32 78 | #undef pixel 79 | #undef RefreshSprites 80 | #undef RefreshBorder 81 | #undef RefreshLine0 82 | #undef RefreshLine1 83 | #undef RefreshLine2 84 | #undef RefreshLine3 85 | 86 | /** SetScreenDepth() *****************************************/ 87 | /** Fill TMS9918 screen driver array with pointers matching **/ 88 | /** the given image depth. **/ 89 | /*************************************************************/ 90 | int SetScreenDepth(int Depth) 91 | { 92 | if(Depth<=8) 93 | { 94 | Depth=8; 95 | Screen9918[0].LineHandler = RefreshLine0_8; 96 | Screen9918[1].LineHandler = RefreshLine1_8; 97 | Screen9918[2].LineHandler = RefreshLine2_8; 98 | Screen9918[3].LineHandler = RefreshLine3_8; 99 | } 100 | else if(Depth<=16) 101 | { 102 | Depth=16; 103 | Screen9918[0].LineHandler = RefreshLine0_16; 104 | Screen9918[1].LineHandler = RefreshLine1_16; 105 | Screen9918[2].LineHandler = RefreshLine2_16; 106 | Screen9918[3].LineHandler = RefreshLine3_16; 107 | } 108 | else if(Depth<=32) 109 | { 110 | Depth=32; 111 | Screen9918[0].LineHandler = RefreshLine0_32; 112 | Screen9918[1].LineHandler = RefreshLine1_32; 113 | Screen9918[2].LineHandler = RefreshLine2_32; 114 | Screen9918[3].LineHandler = RefreshLine3_32; 115 | } 116 | else 117 | { 118 | /* Wrong depth */ 119 | Depth=0; 120 | } 121 | 122 | return(Depth); 123 | } 124 | 125 | #endif /* DISPLAY_H */ 126 | -------------------------------------------------------------------------------- /src/ColEm/Help.h: -------------------------------------------------------------------------------- 1 | /** ColEm: portable Coleco emulator **************************/ 2 | /** **/ 3 | /** Help.h **/ 4 | /** **/ 5 | /** This file contains help information printed out by the **/ 6 | /** main() routine when started with option "-help". **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | 14 | char *HelpText[] = 15 | { 16 | "\nUsage: colem [-option1 [-option2...]] [filename]", 17 | "\n[filename] = Name of the file to load as a cartridge [CART.ROM]", 18 | #if defined(ZLIB) 19 | " This program will transparently uncompress singular GZIPped", 20 | " and PKZIPped files.", 21 | #endif 22 | "\n[-option] =", 23 | " -verbose - Select debugging messages [5]", 24 | " 0 - Silent 1 - Startup messages", 25 | " 2 - VDP 4 - Illegal Z80 ops", 26 | " 8 - EEPROM 16 - Sound", 27 | " -pal/-ntsc - Video system to use [-ntsc]", 28 | " -skip - Percentage of frames to skip [25]", 29 | " -help - Print this help page", 30 | " -home - Set directory with system ROM files [off]", 31 | " -adam/-cv - Run in Adam/ColecoVision mode [-cv]", 32 | " -sgm/-nosgm - Enable Super Game Module extension [-nosgm]", 33 | " -24c08/-24c256 - Enable serial EEPROM emulation [off]", 34 | " -sram - Enable battery-backed SRAM emulation [off]", 35 | " -allspr - Show all sprites [off]", 36 | " -autoa/-noautoa - Autofire/No autofire for FIRE-R button [-noautoa]", 37 | " -autob/-noautob - Autofire/No autofire for FIRE-L button [-noautob]", 38 | 39 | " -spin1x/-spin1y - Mouse X/Y position as SuperAction spinner 1 [off]", 40 | " -spin2x/-spin2y - Mouse X/Y position as SuperAction spinner 2 [off]", 41 | " -drums/-nodrums - Hit/Don't hit MIDI drums on noise [-nodrums]", 42 | " -logsnd - Write soundtrack to a MIDI file [LOG.MID]", 43 | " -palette - Use given color palette [0]", 44 | " 0 - Scaled VDP colors 1 - Original VDP colors", 45 | " 2 - Faded NTSC colors", 46 | " -sound [] - Sound emulation quality [22050]", 47 | " -nosound - Don't emulate sound [-nosound]", 48 | 49 | #if defined(DEBUG) 50 | " -trap
- Trap execution when PC reaches address [FFFFh]", 51 | #endif /* DEBUG */ 52 | 53 | #if defined(MSDOS) || defined(UNIX) || defined(MAEMO) 54 | " -sync - Sync screen updates to [-sync 60]", 55 | " -nosync - Do not sync screen updates", 56 | " -tv/-lcd/-raster - Simulate TV scanlines or LCD raster [off]", 57 | " -soft/-eagle - Scale display with 2xSaI or EAGLE [off]", 58 | " -epx/-scale2x - Scale display with EPX or Scale2X [off]", 59 | " -cmy/-rgb - Simulate CMY/RGB pixel raster [off]", 60 | " -mono/-sepia - Simulate monochrome or sepia CRT [off]", 61 | " -green/-amber - Simulate green or amber CRT [off]", 62 | " -4x3 - Force 4:3 television screen ratio [off]", 63 | #endif /* MSDOS || UNIX || MAEMO */ 64 | 65 | #if defined(UNIX) || defined(MAEMO) 66 | " -saver/-nosaver - Save/don't save CPU when inactive [-saver]", 67 | #endif /* UNIX || MAEMO */ 68 | 69 | #if defined(UNIX) 70 | #if defined(MITSHM) 71 | " -shm/-noshm - Use/don't use MIT SHM extensions for X [-shm]", 72 | #endif 73 | " -scale - Scale window by [2]", 74 | #endif /* UNIX */ 75 | 76 | #if defined(MSDOS) 77 | " -vsync - Sync screen updates to VGA VBlanks [-vsync]", 78 | #endif /* MSDOS */ 79 | 80 | "\nKeyboard bindings:", 81 | " [ALT] - Hold to switch to the second controller", 82 | " [SPACE] - FIRE-R button (also: [SHIFT],A,S,D,F,G,H,J,K,L)", 83 | " [CONTROL] - FIRE-L button (also: Z,X,C,V,B,N,M)", 84 | " [Q] - SuperAction PURPLE button (also: E,T,U,O)", 85 | " [W] - SuperAction BLUE button (also: R,Y,I,P)", 86 | " [0]-[9] - Digit buttons", 87 | " [-] - [*] button", 88 | " [=] - [#] button", 89 | " [PGUP] - Fast-forward emulation (also: [F9])", 90 | " [ESC] - Quit emulation (also: [F12])", 91 | #if defined(DEBUG) 92 | " [F1] - Go into the built-in debugger", 93 | #endif 94 | " [F2] - Turn soundtrack log on/off", 95 | " [F3] - Toggle FIRE-R autofire on/off", 96 | " [F4] - Toggle FIRE-L autofire on/off", 97 | " [F5] - Invoke configuration menu", 98 | " [F6] - Load emulation state", 99 | " [F7] - Save emulation state", 100 | " [F8] - Replay recorded gameplay", 101 | " [SHIFT]+[F8] - Toggle gameplay recorder on/off", 102 | " [F9] - Fast-forward emulation (also: [PGUP])", 103 | #if defined(GIFLIB) 104 | " [F10] - Make a screen snapshot (SNAPxxxx.GIF)", 105 | #endif 106 | " [F11] - Reset hardware", 107 | " [F12] - Quit emulation (also: [ESC])", 108 | " [ALT]+[PGUP] - Increase audio volume", 109 | " [ALT]+[PGDOWN] - Decrease audio volume", 110 | #if defined(WINDOWS) 111 | " [ALT]+[ENTER] - Switch between full scren and window modes", 112 | #endif 113 | 0 114 | }; 115 | -------------------------------------------------------------------------------- /src/ColEm/State.h: -------------------------------------------------------------------------------- 1 | /** ColEm: portable Coleco emulator **************************/ 2 | /** **/ 3 | /** State.h **/ 4 | /** **/ 5 | /** This file contains routines to save and load emulation **/ 6 | /** state. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2019 **/ 9 | /** The contents of this file are property of Marat **/ 10 | /** Fayzullin and should only be used as agreed with **/ 11 | /** him. The file is confidential. Absolutely no **/ 12 | /** distribution allowed. **/ 13 | /*************************************************************/ 14 | #ifndef STATE_H 15 | #define STATE_H 16 | 17 | #define SaveSTRUCT(Name) \ 18 | if(Size+sizeof(Name)>MaxSize) return(0); \ 19 | else { memcpy(Buf+Size,&(Name),sizeof(Name));Size+=sizeof(Name); } 20 | 21 | #define SaveARRAY(Name) \ 22 | if(Size+sizeof(Name)>MaxSize) return(0); \ 23 | else { memcpy(Buf+Size,(Name),sizeof(Name));Size+=sizeof(Name); } 24 | 25 | #define SaveDATA(Name,DataSize) \ 26 | if(Size+(DataSize)>MaxSize) return(0); \ 27 | else { memcpy(Buf+Size,(Name),(DataSize));Size+=(DataSize); } 28 | 29 | #define LoadSTRUCT(Name) \ 30 | if(Size+sizeof(Name)>MaxSize) return(0); \ 31 | else { memcpy(&(Name),Buf+Size,sizeof(Name));Size+=sizeof(Name); } 32 | 33 | #define SkipSTRUCT(Name) \ 34 | if(Size+sizeof(Name)>MaxSize) return(0); \ 35 | else Size+=sizeof(Name) 36 | 37 | #define HaveSTRUCT(Name) \ 38 | (Size+sizeof(Name)<=MaxSize) 39 | 40 | #define LoadARRAY(Name) \ 41 | if(Size+sizeof(Name)>MaxSize) return(0); \ 42 | else { memcpy((Name),Buf+Size,sizeof(Name));Size+=sizeof(Name); } 43 | 44 | #define LoadDATA(Name,DataSize) \ 45 | if(Size+(DataSize)>MaxSize) return(0); \ 46 | else { memcpy((Name),Buf+Size,(DataSize));Size+=(DataSize); } 47 | 48 | #define SkipDATA(DataSize) \ 49 | if(Size+(DataSize)>MaxSize) return(0); \ 50 | else Size+=(DataSize) 51 | 52 | /** SaveState() **********************************************/ 53 | /** Save emulation state to a memory buffer. Returns size **/ 54 | /** on success, 0 on failure. **/ 55 | /*************************************************************/ 56 | unsigned int SaveState(unsigned char *Buf,unsigned int MaxSize) 57 | { 58 | unsigned int State[256],Size; 59 | int J; 60 | 61 | /* No data written yet */ 62 | Size = 0; 63 | 64 | /* Generate hardware state */ 65 | J=0; 66 | memset(State,0,sizeof(State)); 67 | State[J++] = Mode; 68 | State[J++] = UPeriod; 69 | State[J++] = ROMPage[0]-RAM; 70 | State[J++] = ROMPage[1]-RAM; 71 | State[J++] = ROMPage[2]-RAM; 72 | State[J++] = ROMPage[3]-RAM; 73 | State[J++] = ROMPage[4]-RAM; 74 | State[J++] = ROMPage[5]-RAM; 75 | State[J++] = ROMPage[6]-RAM; 76 | State[J++] = ROMPage[7]-RAM; 77 | State[J++] = RAMPage[0]-RAM; 78 | State[J++] = RAMPage[1]-RAM; 79 | State[J++] = RAMPage[2]-RAM; 80 | State[J++] = RAMPage[3]-RAM; 81 | State[J++] = RAMPage[4]-RAM; 82 | State[J++] = RAMPage[5]-RAM; 83 | State[J++] = RAMPage[6]-RAM; 84 | State[J++] = RAMPage[7]-RAM; 85 | State[J++] = JoyMode; 86 | State[J++] = Port20; 87 | State[J++] = Port60; 88 | State[J++] = MegaPage; 89 | State[J++] = Port53; 90 | 91 | /* Save CPU state */ 92 | SaveSTRUCT(CPU); 93 | 94 | /* Save VDP state */ 95 | J = Save9918(&VDP,Buf+Size,MaxSize-Size); 96 | if(!J) return(0); else Size+=J; 97 | 98 | /* Save remaining states */ 99 | SaveSTRUCT(PSG); 100 | SaveARRAY(State); 101 | SaveDATA(RAM_BASE,0xA000); 102 | SaveDATA(VDP.VRAM,0x4000); 103 | SaveSTRUCT(AYPSG); 104 | 105 | /* Return amount of data written */ 106 | return(Size); 107 | } 108 | 109 | /** LoadState() **********************************************/ 110 | /** Load emulation state from a memory buffer. Returns size **/ 111 | /** on success, 0 on failure. **/ 112 | /*************************************************************/ 113 | unsigned int LoadState(unsigned char *Buf,unsigned int MaxSize) 114 | { 115 | int State[256],J; 116 | unsigned int Size; 117 | 118 | /* No data read yet */ 119 | Size = 0; 120 | 121 | /* Load CPU state */ 122 | LoadSTRUCT(CPU); 123 | 124 | /* Load VDP state */ 125 | J = Load9918(&VDP,Buf+Size,MaxSize-Size); 126 | if(!J) return(0); else Size+=J; 127 | 128 | /* Load remaining states */ 129 | LoadSTRUCT(PSG); 130 | LoadARRAY(State); 131 | LoadDATA(RAM_BASE,0xA000); 132 | LoadDATA(VDP.VRAM,0x4000); 133 | 134 | /* Older saves may not have this */ 135 | if(HaveSTRUCT(AYPSG)) { LoadSTRUCT(AYPSG); } 136 | else Reset8910(&AYPSG,CPU_CLOCK/2,SN76489_CHANNELS); 137 | 138 | /* Parse hardware state */ 139 | J=0; 140 | Mode = State[J++]; 141 | UPeriod = State[J++]; 142 | ROMPage[0] = State[J++]+RAM; 143 | ROMPage[1] = State[J++]+RAM; 144 | ROMPage[2] = State[J++]+RAM; 145 | ROMPage[3] = State[J++]+RAM; 146 | ROMPage[4] = State[J++]+RAM; 147 | ROMPage[5] = State[J++]+RAM; 148 | ROMPage[6] = State[J++]+RAM; 149 | ROMPage[7] = State[J++]+RAM; 150 | RAMPage[0] = State[J++]+RAM; 151 | RAMPage[1] = State[J++]+RAM; 152 | RAMPage[2] = State[J++]+RAM; 153 | RAMPage[3] = State[J++]+RAM; 154 | RAMPage[4] = State[J++]+RAM; 155 | RAMPage[5] = State[J++]+RAM; 156 | RAMPage[6] = State[J++]+RAM; 157 | RAMPage[7] = State[J++]+RAM; 158 | JoyMode = State[J++]; 159 | Port20 = State[J++]; 160 | Port60 = State[J++]; 161 | MegaPage = State[J++]&(MegaSize-1); 162 | Port53 = State[J++]; 163 | 164 | /* Normal cartridges have fixed ROM pages */ 165 | if(MegaSize<=2) MegaPage=1; 166 | 167 | /* All PSG channels have been changed */ 168 | PSG.Changed = 0x80|((1<>8)&0xFF; 209 | Header[8] = (J>>16)&0xFF; 210 | Header[9] = (J>>24)&0xFF; 211 | 212 | /* Write out the header and the data */ 213 | if(F && (fwrite(Header,1,16,F)!=16)) { fclose(F);F=0; } 214 | if(F && (fwrite(Buf,1,Size,F)!=Size)) { fclose(F);F=0; } 215 | 216 | /* If failed writing state, delete open file */ 217 | if(F) fclose(F); else unlink(Name); 218 | 219 | /* Done */ 220 | free(Buf); 221 | return(!!F); 222 | } 223 | 224 | /** LoadSTA() ************************************************/ 225 | /** Load emulation state from a .STA file. Returns 1 on **/ 226 | /** success, 0 on failure. **/ 227 | /*************************************************************/ 228 | int LoadSTA(const char *Name) 229 | { 230 | byte Header[16],*Buf; 231 | int Size,OldMode,J; 232 | FILE *F; 233 | 234 | /* Fail if no state file */ 235 | if(!Name) return(0); 236 | 237 | /* Open saved state file */ 238 | if(!(F=fopen(Name,"rb"))) return(0); 239 | 240 | /* Read and check the header */ 241 | if(fread(Header,1,16,F)!=16) { fclose(F);return(0); } 242 | if(memcmp(Header,"STF\032\002",5)) { fclose(F);return(0); } 243 | J = LastCRC; 244 | if( 245 | (Header[5]!=(Mode&CV_ADAM)) || 246 | (Header[6]!=(J&0xFF)) || 247 | (Header[7]!=((J>>8)&0xFF)) || 248 | (Header[8]!=((J>>16)&0xFF)) || 249 | (Header[9]!=((J>>24)&0xFF)) 250 | ) { fclose(F);return(0); } 251 | 252 | /* Allocate temporary buffer */ 253 | Buf = malloc(MAX_STASIZE); 254 | if(!Buf) { fclose(F);return(0); } 255 | 256 | /* Read state into temporary buffer, then load it */ 257 | OldMode = Mode; 258 | Size = fread(Buf,1,MAX_STASIZE,F); 259 | Size = Size>0? LoadState(Buf,Size):0; 260 | 261 | /* If failed loading state, reset hardware */ 262 | if(!Size) ResetColeco(OldMode); 263 | 264 | /* Done */ 265 | free(Buf); 266 | fclose(F); 267 | return(!!Size); 268 | } 269 | 270 | #endif /* STATE_H */ 271 | -------------------------------------------------------------------------------- /src/ColEm/Wii/wii_types.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_TYPES_H 30 | #define WII_TYPES_H 31 | 32 | // Typedefs 33 | #ifndef BYTE_TYPE_DEFINED 34 | #define BYTE_TYPE_DEFINED 35 | typedef unsigned char byte; 36 | #endif 37 | 38 | #ifndef WORD_TYPE_DEFINED 39 | #define WORD_TYPE_DEFINED 40 | typedef unsigned short word; 41 | #endif 42 | 43 | typedef unsigned int uint; 44 | typedef unsigned char uchar; 45 | typedef unsigned long long ullong; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /src/EMULib/AY8910.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** AY8910.h **/ 4 | /** **/ 5 | /** This file contains emulation for the AY8910 sound chip **/ 6 | /** produced by General Instruments, Yamaha, etc. See **/ 7 | /** AY8910.c for the actual code. **/ 8 | /** **/ 9 | /** Copyright (C) Marat Fayzullin 1996-2019 **/ 10 | /** You are not allowed to distribute this software **/ 11 | /** commercially. Please, notify me, if you make any **/ 12 | /** changes to this file. **/ 13 | /*************************************************************/ 14 | #ifndef AY8910_H 15 | #define AY8910_H 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | #define AY8910_CHANNELS 6 /* 3 melodic + 3 noise chanls */ 21 | 22 | #define AY8910_ASYNC 0 /* Asynchronous emulation */ 23 | #define AY8910_SYNC 1 /* Synchronous emulation */ 24 | #define AY8910_FLUSH 2 /* Flush buffers only */ 25 | #define AY8910_DRUMS 0x80 /* Hit drums for noise chnls */ 26 | 27 | #ifndef BYTE_TYPE_DEFINED 28 | #define BYTE_TYPE_DEFINED 29 | typedef unsigned char byte; 30 | #endif 31 | 32 | /** AY8910 ***************************************************/ 33 | /** This data structure stores AY8910 state. **/ 34 | /*************************************************************/ 35 | #pragma pack(4) 36 | typedef struct 37 | { 38 | byte R[16]; /* PSG registers contents */ 39 | 40 | /* THESE VALUES ARE NOT USED BUT KEPT FOR BACKWARD COMPATIBILITY */ 41 | int Freq[AY8910_CHANNELS]; /* Frequencies (0 for off) */ 42 | int Volume[AY8910_CHANNELS]; /* Volumes (0..255) */ 43 | 44 | int Clock; /* Base clock rate (Fin/16) */ 45 | int First; /* First used Sound() channel */ 46 | byte Changed; /* Bitmap of changed channels */ 47 | byte Sync; /* AY8910_SYNC/AY8910_ASYNC */ 48 | byte Latch; /* Latch for the register num */ 49 | int EPeriod; /* Envelope step in microsecs */ 50 | int ECount; /* Envelope step counter */ 51 | int EPhase; /* Envelope phase */ 52 | } AY8910; 53 | #pragma pack() 54 | 55 | /** Reset8910() **********************************************/ 56 | /** Reset the sound chip and use sound channels from the **/ 57 | /** one given in First. **/ 58 | /*************************************************************/ 59 | void Reset8910(register AY8910 *D,int ClockHz,int First); 60 | 61 | /** Write8910() **********************************************/ 62 | /** Call this function to output a value V into the sound **/ 63 | /** chip. **/ 64 | /*************************************************************/ 65 | void Write8910(register AY8910 *D,register byte R,register byte V); 66 | 67 | /** WrCtrl8910() *********************************************/ 68 | /** Write a value V to the PSG Control Port. **/ 69 | /*************************************************************/ 70 | void WrCtrl8910(AY8910 *D,byte V); 71 | 72 | /** WrData8910() *********************************************/ 73 | /** Write a value V to the PSG Data Port. **/ 74 | /*************************************************************/ 75 | void WrData8910(AY8910 *D,byte V); 76 | 77 | /** RdData8910() *********************************************/ 78 | /** Read a value from the PSG Data Port. **/ 79 | /*************************************************************/ 80 | byte RdData8910(AY8910 *D); 81 | 82 | /** Sync8910() ***********************************************/ 83 | /** Flush all accumulated changes by issuing Sound() calls **/ 84 | /** and set the synchronization on/off. The second argument **/ 85 | /** should be AY8910_SYNC/AY8910_ASYNC to set/reset sync, **/ 86 | /** or AY8910_FLUSH to leave sync mode as it is. To emulate **/ 87 | /** noise channels with MIDI drums, OR second argument with **/ 88 | /** AY8910_DRUMS. **/ 89 | /*************************************************************/ 90 | void Sync8910(register AY8910 *D,register byte Sync); 91 | 92 | /** Loop8910() ***********************************************/ 93 | /** Call this function periodically to update volume **/ 94 | /** envelopes. Use uSec to pass the time since the last **/ 95 | /** call of Loop8910() in microseconds. **/ 96 | /*************************************************************/ 97 | void Loop8910(register AY8910 *D,int uSec); 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | #endif /* AY8910_H */ 103 | -------------------------------------------------------------------------------- /src/EMULib/C24XX.c: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** C24XX.c **/ 4 | /** **/ 5 | /** This file contains emulation for the 24cXX series of **/ 6 | /** serial EEPROMs. See C24XX.h for declarations. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2017-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | 14 | #include "C24XX.h" 15 | #include 16 | #include 17 | 18 | /** Internal Chip States *************************************/ 19 | #define RECV_CMD 0 20 | #define RECV_ADDR 1 21 | #define RECV_ADR2 2 22 | #define RECV_DATA 3 23 | #define SEND_DATA 4 24 | 25 | /** Size24XX *************************************************/ 26 | /** Return the size of given chip model in bytes. **/ 27 | /*************************************************************/ 28 | unsigned int Size24XX(C24XX *D) 29 | { 30 | unsigned int Chip = D->Flags&C24XX_CHIP; 31 | return(Chip<=C24XX_24C1024? (0x80<Pins = C24XX_SDA|C24XX_SCL; 40 | D->Out = C24XX_SDA|C24XX_SCL; 41 | D->State = RECV_CMD; 42 | D->Bits = 0x0001; 43 | D->Cmd = 0x00; 44 | D->Addr = 0; 45 | D->Data = Data; 46 | D->Flags = Flags; 47 | D->Rsrvd = 0; 48 | } 49 | 50 | /** Save24XX() ***********************************************/ 51 | /** Save 24xx chip state to a given buffer of given maximal **/ 52 | /** size. Returns number of bytes saved or 0 on failure. **/ 53 | /** EEPROM contents are not saved. **/ 54 | /*************************************************************/ 55 | unsigned int Save24XX(const register C24XX *D,byte *Buf,unsigned int Size) 56 | { 57 | unsigned int N = (const byte *)&(D->Data) - (const byte *)D; 58 | if(N>Size) return(0); 59 | memcpy(Buf,D,N); 60 | return(N); 61 | } 62 | 63 | /** Load24XX() ***********************************************/ 64 | /** Load 24xx chip state from given buffer of given maximal **/ 65 | /** size. Returns number of bytes loaded or 0 on failure. **/ 66 | /** EEPROM contents are not loaded. **/ 67 | /*************************************************************/ 68 | unsigned int Load24XX(register C24XX *D,byte *Buf,unsigned int Size) 69 | { 70 | unsigned int N = (const byte *)&(D->Data) - (const byte *)D; 71 | if(N>Size) return(0); 72 | memcpy(D,Buf,N); 73 | return(N); 74 | } 75 | 76 | /** Read24XX *************************************************/ 77 | /** Read value from the 24xx chip. Only bits 0,1 are used **/ 78 | /** (see #defines). **/ 79 | /*************************************************************/ 80 | byte Read24XX(C24XX *D) 81 | { 82 | // if(D->Flags&C24XX_DEBUG) 83 | // printf("EEPROM SDA=%d, SCL=%d\n",D->Pins&C24XX_SDA? 1:0,D->Pins&C24XX_SCL? 1:0); 84 | 85 | return(D->Out); 86 | } 87 | 88 | /** Write24XX ************************************************/ 89 | /** Write value V into the 24xx chip. Only bits 0,1 are **/ 90 | /** used (see #defines). **/ 91 | /*************************************************************/ 92 | byte Write24XX(C24XX *D,byte V) 93 | { 94 | static const unsigned int PageSize[16] = 95 | { 8,8,16,16,16,32,32,64,128,256,256,256,256,256,256,256 }; 96 | 97 | word J; 98 | 99 | // if((D->Flags&C24XX_DEBUG)&&((D->Pins^V)&(C24XX_SDA|C24XX_SCL))) 100 | // printf("EEPROM SDA: %d=>%d, SCL: %d=>%d\n", 101 | // D->Pins&C24XX_SDA? 1:0,V&C24XX_SDA? 1:0, 102 | // D->Pins&C24XX_SCL? 1:0,V&C24XX_SCL? 1:0 103 | // ); 104 | 105 | /* When SDA line changes while SCL=1... */ 106 | if(((D->Pins^V)&C24XX_SDA) && (D->Pins&V&C24XX_SCL)) 107 | { 108 | if(V&C24XX_SDA) 109 | { 110 | /* SDA=1: STOP condition */ 111 | if(D->Flags&C24XX_DEBUG) printf("EEPROM STOP\n"); 112 | D->State = RECV_CMD; 113 | D->Bits = 0x0001; 114 | } 115 | else 116 | { 117 | /* SDA=0: START condition */ 118 | if(D->Flags&C24XX_DEBUG) printf("EEPROM START\n"); 119 | D->State = RECV_CMD; 120 | D->Bits = 0x0001; 121 | } 122 | } 123 | /* When SCL line goes up... */ 124 | else if((D->Pins^V)&V&C24XX_SCL) 125 | { 126 | if((D->State==SEND_DATA) && (D->Bits!=0x8000)) 127 | { 128 | /* Report current output bit */ 129 | D->Out = (D->Out&~C24XX_SDA)|(D->Bits&0x8000? C24XX_SDA:0); 130 | /* Shift output bits */ 131 | D->Bits<<=1; 132 | } 133 | else if((D->State!=SEND_DATA) && (D->Bits<0x0100)) 134 | { 135 | /* Shift input bits */ 136 | D->Bits = (D->Bits<<1)|(V&C24XX_SDA? 1:0); 137 | } 138 | else 139 | { 140 | /* Depending on the state... */ 141 | switch(D->State) 142 | { 143 | case RECV_CMD: 144 | D->Cmd = D->Bits&0x00FF; 145 | D->State = (D->Cmd&0xF0)!=0xA0? RECV_CMD:D->Cmd&0x01? SEND_DATA:RECV_ADDR; 146 | if(D->Flags&C24XX_DEBUG) printf("EEPROM CMD=%02Xh(, ADDR=%Xh)\n",D->Cmd,D->Addr); 147 | break; 148 | case RECV_ADDR: 149 | D->Addr = ((unsigned int)(D->Cmd&0x0E)<<7)+(D->Bits&0x00FF); 150 | D->Addr &= (0x80<<(D->Flags&C24XX_CHIP))-1; 151 | D->State = (D->Flags&C24XX_CHIP)>=C24XX_24C32? RECV_ADR2:RECV_DATA; 152 | if(D->Flags&C24XX_DEBUG) printf("EEPROM CMD=%02Xh, ADDR=%Xh\n",D->Cmd,D->Addr); 153 | break; 154 | case RECV_ADR2: 155 | D->Addr = (D->Addr<<8)+(D->Bits&0x00FF); 156 | D->Addr &= (0x80<<(D->Flags&C24XX_CHIP))-1; 157 | D->State = RECV_DATA; 158 | if(D->Flags&C24XX_DEBUG) printf("EEPROM CMD=%02Xh, ADDR=%Xh\n",D->Cmd,D->Addr); 159 | break; 160 | case RECV_DATA: 161 | if(D->Flags&C24XX_DEBUG) printf("EEPROM WRITE[%Xh] <= %02Xh\n",D->Addr,D->Bits&0xFF); 162 | /* Write byte into EEPROM */ 163 | D->Data[D->Addr] = D->Bits&0x00FF; 164 | /* Go to the next address inside N-byte page */ 165 | J = PageSize[D->Flags&C24XX_CHIP]-1; 166 | D->Addr = ((D->Addr+1)&J)|(D->Addr&~J); 167 | break; 168 | case SEND_DATA: 169 | /* See below */ 170 | break; 171 | default: 172 | D->State = RECV_CMD; 173 | break; 174 | } 175 | /* Acknowledge received byte, clear bit buffer */ 176 | D->Bits = 0x0001; 177 | D->Out = C24XX_SCL; 178 | /* If sending the next byte... */ 179 | if(D->State==SEND_DATA) 180 | { 181 | /* Read byte from EEPROM */ 182 | D->Bits = ((word)D->Data[D->Addr]<<8)|0x0080; 183 | if(D->Flags&C24XX_DEBUG) printf("EEPROM READ[%Xh] => %02Xh\n",D->Addr,D->Bits>>8); 184 | /* Go to the next address inside N-byte page */ 185 | J = PageSize[D->Flags&C24XX_CHIP]-1; 186 | D->Addr = ((D->Addr+1)&J)|(D->Addr&~J); 187 | } 188 | } 189 | } 190 | 191 | /* New pin values */ 192 | D->Pins = V; 193 | 194 | /* Done */ 195 | return(D->Out); 196 | } 197 | -------------------------------------------------------------------------------- /src/EMULib/C24XX.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** C24XX.h **/ 4 | /** **/ 5 | /** This file contains emulation for the 24cXX series of **/ 6 | /** serial EEPROMs. See C24XX.c for the actual code. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2017-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef C24XX_H 14 | #define C24XX_H 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define C24XX_CHIP 0x0F 20 | #define C24XX_24C01 0x00 // 128 bytes (7bit, 8/page) 21 | #define C24XX_24C02 0x01 // 256 bytes (8bit, 8/page) 22 | #define C24XX_24C04 0x02 // 512 bytes (1+8bit, 16/page) 23 | #define C24XX_24C08 0x03 // 1024 bytes (2+8bit, 16/page) 24 | #define C24XX_24C16 0x04 // 2048 bytes (3+8bit, 16/page) 25 | #define C24XX_24C32 0x05 // 4096 bytes (12bit, 32/page) 26 | #define C24XX_24C64 0x06 // 8192 bytes (13bit, 32/page) 27 | #define C24XX_24C128 0x07 // 16384 bytes (14bit, 64/page) 28 | #define C24XX_24C256 0x08 // 32768 bytes (15bit, 64/page) 29 | #define C24XX_24C512 0x09 // 65536 bytes (16bit, 128/page) 30 | #define C24XX_24C1024 0x0A // 131072 bytes (1+16bit, 256/page) 31 | #define C24XX_DEBUG 0x10 32 | 33 | /* Alternative chip names */ 34 | #define C24XX_128B C24XX_24C01 35 | #define C24XX_256B C24XX_24C02 36 | #define C24XX_512B C24XX_24C04 37 | #define C24XX_1kB C24XX_24C08 38 | #define C24XX_2kB C24XX_24C16 39 | #define C24XX_4kB C24XX_24C32 40 | #define C24XX_8kB C24XX_24C64 41 | #define C24XX_16kB C24XX_24C128 42 | #define C24XX_32kB C24XX_24C256 43 | #define C24XX_64kB C24XX_24C512 44 | #define C24XX_128kB C24XX_24C1024 45 | 46 | #define C24XX_SDA 0x01 47 | #define C24XX_SCL 0x02 48 | #define C24XX_ADDR 0x1C 49 | #define C24XX_A0 0x04 50 | #define C24XX_A1 0x08 51 | #define C24XX_A2 0x10 52 | 53 | #ifndef BYTE_TYPE_DEFINED 54 | #define BYTE_TYPE_DEFINED 55 | typedef unsigned char byte; 56 | #endif 57 | 58 | #ifndef WORD_TYPE_DEFINED 59 | #define WORD_TYPE_DEFINED 60 | typedef unsigned short word; 61 | #endif 62 | 63 | #pragma pack(4) 64 | typedef struct 65 | { 66 | unsigned int Flags; /* Chip type, etc */ 67 | unsigned int Addr; /* Current address */ 68 | int Rsrvd; /* Reserved field */ 69 | byte State; /* Current state */ 70 | byte Cmd; /* Current command */ 71 | word Bits; /* In/out bits */ 72 | byte Pins; /* Input pins */ 73 | byte Out; /* Output pins */ 74 | /*--- Save24XX() will save state above this line ---*/ 75 | byte *Data; /* Pointer to data */ 76 | } C24XX; 77 | #pragma pack() 78 | 79 | /** Reset24XX ************************************************/ 80 | /** Reset the 24xx chip. **/ 81 | /*************************************************************/ 82 | void Reset24XX(C24XX *D,byte *Data,unsigned int Flags); 83 | 84 | /** Write24XX ************************************************/ 85 | /** Write value V into the 24xx chip. Only bits 0,1 are **/ 86 | /** used (see #defines). **/ 87 | /*************************************************************/ 88 | byte Write24XX(C24XX *D,byte V); 89 | 90 | /** Read24XX *************************************************/ 91 | /** Read value from the 24xx chip. Only bits 0,1 are used **/ 92 | /** (see #defines). **/ 93 | /*************************************************************/ 94 | byte Read24XX(C24XX *D); 95 | 96 | /** Size24XX *************************************************/ 97 | /** Return the size of given chip model in bytes. **/ 98 | /*************************************************************/ 99 | unsigned int Size24XX(C24XX *D); 100 | 101 | /** Save24XX() ***********************************************/ 102 | /** Save 24xx chip state to a given buffer of given maximal **/ 103 | /** size. Returns number of bytes saved or 0 on failure. **/ 104 | /** EEPROM contents are not saved. **/ 105 | /*************************************************************/ 106 | unsigned int Save24XX(const register C24XX *D,byte *Buf,unsigned int Size); 107 | 108 | /** Load24XX() ***********************************************/ 109 | /** Load 24xx chip state from given buffer of given maximal **/ 110 | /** size. Returns number of bytes loaded or 0 on failure. **/ 111 | /** EEPROM contents are not loaded. **/ 112 | /*************************************************************/ 113 | unsigned int Load24XX(register C24XX *D,byte *Buf,unsigned int Size); 114 | 115 | #ifdef __cplusplus 116 | } 117 | #endif 118 | #endif /* C24XX_H */ 119 | -------------------------------------------------------------------------------- /src/EMULib/CRC32.c: -------------------------------------------------------------------------------- 1 | #include "CRC32.h" 2 | 3 | unsigned int ComputeCRC32(unsigned int InCRC32,const unsigned char *Buf,unsigned int Length) 4 | { 5 | static const unsigned int Table[256] = 6 | { 7 | 0x00000000,0x77073096,0xEE0E612C,0x990951BA,0x076DC419,0x706AF48F,0xE963A535, 8 | 0x9E6495A3,0x0EDB8832,0x79DCB8A4,0xE0D5E91E,0x97D2D988,0x09B64C2B,0x7EB17CBD, 9 | 0xE7B82D07,0x90BF1D91,0x1DB71064,0x6AB020F2,0xF3B97148,0x84BE41DE,0x1ADAD47D, 10 | 0x6DDDE4EB,0xF4D4B551,0x83D385C7,0x136C9856,0x646BA8C0,0xFD62F97A,0x8A65C9EC, 11 | 0x14015C4F,0x63066CD9,0xFA0F3D63,0x8D080DF5,0x3B6E20C8,0x4C69105E,0xD56041E4, 12 | 0xA2677172,0x3C03E4D1,0x4B04D447,0xD20D85FD,0xA50AB56B,0x35B5A8FA,0x42B2986C, 13 | 0xDBBBC9D6,0xACBCF940,0x32D86CE3,0x45DF5C75,0xDCD60DCF,0xABD13D59,0x26D930AC, 14 | 0x51DE003A,0xC8D75180,0xBFD06116,0x21B4F4B5,0x56B3C423,0xCFBA9599,0xB8BDA50F, 15 | 0x2802B89E,0x5F058808,0xC60CD9B2,0xB10BE924,0x2F6F7C87,0x58684C11,0xC1611DAB, 16 | 0xB6662D3D,0x76DC4190,0x01DB7106,0x98D220BC,0xEFD5102A,0x71B18589,0x06B6B51F, 17 | 0x9FBFE4A5,0xE8B8D433,0x7807C9A2,0x0F00F934,0x9609A88E,0xE10E9818,0x7F6A0DBB, 18 | 0x086D3D2D,0x91646C97,0xE6635C01,0x6B6B51F4,0x1C6C6162,0x856530D8,0xF262004E, 19 | 0x6C0695ED,0x1B01A57B,0x8208F4C1,0xF50FC457,0x65B0D9C6,0x12B7E950,0x8BBEB8EA, 20 | 0xFCB9887C,0x62DD1DDF,0x15DA2D49,0x8CD37CF3,0xFBD44C65,0x4DB26158,0x3AB551CE, 21 | 0xA3BC0074,0xD4BB30E2,0x4ADFA541,0x3DD895D7,0xA4D1C46D,0xD3D6F4FB,0x4369E96A, 22 | 0x346ED9FC,0xAD678846,0xDA60B8D0,0x44042D73,0x33031DE5,0xAA0A4C5F,0xDD0D7CC9, 23 | 0x5005713C,0x270241AA,0xBE0B1010,0xC90C2086,0x5768B525,0x206F85B3,0xB966D409, 24 | 0xCE61E49F,0x5EDEF90E,0x29D9C998,0xB0D09822,0xC7D7A8B4,0x59B33D17,0x2EB40D81, 25 | 0xB7BD5C3B,0xC0BA6CAD,0xEDB88320,0x9ABFB3B6,0x03B6E20C,0x74B1D29A,0xEAD54739, 26 | 0x9DD277AF,0x04DB2615,0x73DC1683,0xE3630B12,0x94643B84,0x0D6D6A3E,0x7A6A5AA8, 27 | 0xE40ECF0B,0x9309FF9D,0x0A00AE27,0x7D079EB1,0xF00F9344,0x8708A3D2,0x1E01F268, 28 | 0x6906C2FE,0xF762575D,0x806567CB,0x196C3671,0x6E6B06E7,0xFED41B76,0x89D32BE0, 29 | 0x10DA7A5A,0x67DD4ACC,0xF9B9DF6F,0x8EBEEFF9,0x17B7BE43,0x60B08ED5,0xD6D6A3E8, 30 | 0xA1D1937E,0x38D8C2C4,0x4FDFF252,0xD1BB67F1,0xA6BC5767,0x3FB506DD,0x48B2364B, 31 | 0xD80D2BDA,0xAF0A1B4C,0x36034AF6,0x41047A60,0xDF60EFC3,0xA867DF55,0x316E8EEF, 32 | 0x4669BE79,0xCB61B38C,0xBC66831A,0x256FD2A0,0x5268E236,0xCC0C7795,0xBB0B4703, 33 | 0x220216B9,0x5505262F,0xC5BA3BBE,0xB2BD0B28,0x2BB45A92,0x5CB36A04,0xC2D7FFA7, 34 | 0xB5D0CF31,0x2CD99E8B,0x5BDEAE1D,0x9B64C2B0,0xEC63F226,0x756AA39C,0x026D930A, 35 | 0x9C0906A9,0xEB0E363F,0x72076785,0x05005713,0x95BF4A82,0xE2B87A14,0x7BB12BAE, 36 | 0x0CB61B38,0x92D28E9B,0xE5D5BE0D,0x7CDCEFB7,0x0BDBDF21,0x86D3D2D4,0xF1D4E242, 37 | 0x68DDB3F8,0x1FDA836E,0x81BE16CD,0xF6B9265B,0x6FB077E1,0x18B74777,0x88085AE6, 38 | 0xFF0F6A70,0x66063BCA,0x11010B5C,0x8F659EFF,0xF862AE69,0x616BFFD3,0x166CCF45, 39 | 0xA00AE278,0xD70DD2EE,0x4E048354,0x3903B3C2,0xA7672661,0xD06016F7,0x4969474D, 40 | 0x3E6E77DB,0xAED16A4A,0xD9D65ADC,0x40DF0B66,0x37D83BF0,0xA9BCAE53,0xDEBB9EC5, 41 | 0x47B2CF7F,0x30B5FFE9,0xBDBDF21C,0xCABAC28A,0x53B39330,0x24B4A3A6,0xBAD03605, 42 | 0xCDD70693,0x54DE5729,0x23D967BF,0xB3667A2E,0xC4614AB8,0x5D681B02,0x2A6F2B94, 43 | 0xB40BBE37,0xC30C8EA1,0x5A05DF1B,0x2D02EF8D 44 | }; 45 | 46 | unsigned int CRC32,J; 47 | 48 | CRC32 = InCRC32 ^ 0xFFFFFFFF; 49 | 50 | for(J=0;J>8)^Table[(CRC32^Buf[J])&0xFF]; 52 | 53 | return(CRC32^0xFFFFFFFF); 54 | } 55 | -------------------------------------------------------------------------------- /src/EMULib/CRC32.h: -------------------------------------------------------------------------------- 1 | #ifndef CRC32_H 2 | #define CRC32_H 3 | 4 | unsigned int ComputeCRC32(unsigned int InCRC32,const unsigned char *Buf,unsigned int Length); 5 | 6 | #endif /* CRC32_H */ 7 | -------------------------------------------------------------------------------- /src/EMULib/Console.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** Console.h **/ 4 | /** **/ 5 | /** This file contains platform-independent definitions and **/ 6 | /** declarations for the EMULib-based console. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2005-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef CONSOLE_H 14 | #define CONSOLE_H 15 | 16 | #include "EMULib.h" 17 | 18 | #ifdef __cplusplus 19 | extern "C" { 20 | #endif 21 | 22 | /** Special Characters ***************************************/ 23 | /** These are special characters implemented in the default **/ 24 | /** font and used in various standard dialogs. **/ 25 | /*************************************************************/ 26 | #define CON_ARROW 0x01 27 | #define CON_CHECK 0x02 28 | #define CON_FOLDER 0x03 29 | #define CON_FILE 0x04 30 | #define CON_LESS 0x05 31 | #define CON_MORE 0x06 32 | #define CON_BUTTON 0x07 33 | #define CON_BS 0x08 34 | #define CON_TAB 0x09 35 | #define CON_DOTS 0x0B 36 | #define CON_ENTER 0x0D 37 | #define CON_INSERT 0x0E 38 | #define CON_DELETE 0x0F 39 | #define CON_FUNC 0x10 /* 10 keys */ 40 | #define CON_STOP 0x1A 41 | #define CON_ESCAPE 0x1B 42 | 43 | /** CONSetFont Modes *****************************************/ 44 | /** Special font designators passed to CONSetFont(). **/ 45 | /*************************************************************/ 46 | #define FNT_NORMAL (const unsigned char *)0 47 | #define FNT_BOLD (const unsigned char *)1 48 | 49 | /** CONInput() Modes *****************************************/ 50 | /** These are passed to CONInput(). **/ 51 | /*************************************************************/ 52 | #define CON_TEXT 0x00000000 53 | #define CON_DEC 0x80000000 54 | #define CON_HEX 0x40000000 55 | #define CON_HIDE 0x20000000 56 | 57 | /** CONSetColor()/CONSetFont() *******************************/ 58 | /** Set current foreground and background colors, and font. **/ 59 | /*************************************************************/ 60 | void CONSetColor(pixel FGColor,pixel BGColor); 61 | void CONSetFont(const unsigned char *Font); 62 | const unsigned char *CONGetFont(); 63 | 64 | /** CONClear() ***********************************************/ 65 | /** Clear screen with a given color. **/ 66 | /*************************************************************/ 67 | void CONClear(pixel BGColor); 68 | 69 | /** CONBox() *************************************************/ 70 | /** Draw a filled box with a given color. **/ 71 | /*************************************************************/ 72 | void CONBox(int X,int Y,int Width,int Height,pixel BGColor); 73 | 74 | /** CONFrame() ***********************************************/ 75 | /** Draw a frame with a given color. **/ 76 | /*************************************************************/ 77 | void CONFrame(int X,int Y,int Width,int Height,pixel BGColor); 78 | 79 | /** CONChar() ************************************************/ 80 | /** Print a character at given coordinates. **/ 81 | /*************************************************************/ 82 | void CONChar(int X,int Y,char V); 83 | 84 | /** PrintXY() ************************************************/ 85 | /** Print text at given pixel coordinates in given colors. **/ 86 | /** When BG=-1, use transparent background. **/ 87 | /*************************************************************/ 88 | void PrintXY(Image *Img,const char *S,int X,int Y,pixel FG,int BG); 89 | 90 | /** ShadowPrintXY() ******************************************/ 91 | /** Print contrast text at given pixel coordinates in given **/ 92 | /** text and contrast shadow colors. When BG=-1, do not **/ 93 | /** show shadow. **/ 94 | /*************************************************************/ 95 | void ShadowPrintXY(Image *Img,const char *S,int X,int Y,pixel FG,int BG); 96 | 97 | /** CONPrint() ***********************************************/ 98 | /** Print a text at given coordinates with current colors. **/ 99 | /*************************************************************/ 100 | void CONPrint(int X,int Y,const char *S); 101 | 102 | /** CONPrintN() **********************************************/ 103 | /** Print a text at given coordinates with current colors. **/ 104 | /** Truncate with "..." if text length exceeds N. **/ 105 | /*************************************************************/ 106 | void CONPrintN(int X,int Y,const char *S,int N); 107 | 108 | /** CONMsg() *************************************************/ 109 | /** Show a message box. **/ 110 | /*************************************************************/ 111 | void CONMsg(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Title,const char *Text); 112 | 113 | /** CONInput() ***********************************************/ 114 | /** Show an input box. Input modes (text/hex/dec) are ORed **/ 115 | /** to the Length argument. **/ 116 | /*************************************************************/ 117 | char *CONInput(int X,int Y,pixel FGColor,pixel BGColor,const char *Title,char *Input,unsigned int Length); 118 | 119 | /** CONWindow() **********************************************/ 120 | /** Show a titled window. **/ 121 | /*************************************************************/ 122 | void CONWindow(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Title); 123 | 124 | /** CONMenu() ************************************************/ 125 | /** Show a menu. **/ 126 | /*************************************************************/ 127 | int CONMenu(int X,int Y,int W,int H,pixel FGColor,pixel BGColor,const char *Items,int Item); 128 | 129 | /** CONFile() ************************************************/ 130 | /** Show a file selector. **/ 131 | /*************************************************************/ 132 | const char *CONFile(pixel FGColor,pixel BGColor,const char *Ext); 133 | 134 | #ifdef __cplusplus 135 | } 136 | #endif 137 | #endif /* CONSOLE_H */ 138 | -------------------------------------------------------------------------------- /src/EMULib/Hunt.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** Hunt.h **/ 4 | /** **/ 5 | /** This file declares functions to search for possible **/ 6 | /** cheats inside running game data. Also see Hunt.c. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2013-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef HUNT_H 14 | #define HUNT_H 15 | 16 | #define HUNT_BUFSIZE 1024 17 | 18 | /** Flags used in AddHUNT() **********************************/ 19 | #define HUNT_MASK_ID 0x00FF 20 | #define HUNT_MASK_CHANGE 0x0700 21 | #define HUNT_CONSTANT 0x0000 22 | #define HUNT_PLUSONE 0x0100 23 | #define HUNT_PLUSMANY 0x0200 24 | #define HUNT_MINUSONE 0x0300 25 | #define HUNT_MINUSMANY 0x0400 26 | #define HUNT_MASK_SIZE 0x1800 27 | #define HUNT_8BIT 0x0000 28 | #define HUNT_16BIT 0x0800 29 | #define HUNT_32BIT 0x1000 30 | 31 | /** Types used in HUNT2Cheat() *******************************/ 32 | #define HUNT_GBA_GS 0 /* GBA GameShark Advance */ 33 | #define HUNT_GBA_CB 1 /* GBA CodeBreaker Advance */ 34 | #define HUNT_SMS_AR 2 /* SMS Pro Action Replay */ 35 | #define HUNT_NES_AR 3 /* NES Pro Action Replay */ 36 | #define HUNT_GB_GS 4 /* GB GameShark */ 37 | #define HUNT_COLECO 5 /* ColecoVision cheats */ 38 | #define HUNT_MSX 6 /* MSX cheats */ 39 | #define HUNT_ZXS 7 /* ZX Spectrum cheats */ 40 | 41 | /** HUNTEntry ************************************************/ 42 | /** Search entry containing data on one memory location. **/ 43 | /*************************************************************/ 44 | typedef struct 45 | { 46 | unsigned int Addr; /* Memory location address */ 47 | unsigned int Orig; /* Original value at the address */ 48 | unsigned int Value; /* Current value at the address */ 49 | unsigned short Flags; /* Options supplied in AddHUNT() */ 50 | unsigned short Count; /* Number of detected changes */ 51 | } HUNTEntry; 52 | 53 | /** InitHUNT() ***********************************************/ 54 | /** Initialize cheat search, clearing all data. **/ 55 | /*************************************************************/ 56 | void InitHUNT(void); 57 | 58 | /** AddHUNT() ************************************************/ 59 | /** Add a new value to search for, with the address range **/ 60 | /** to search in. Returns number of memory locations found. **/ 61 | /*************************************************************/ 62 | int AddHUNT(unsigned int Addr,unsigned int Size,unsigned int Value,unsigned int NewValue,unsigned int Flags); 63 | 64 | /** ScanHUNT() ***********************************************/ 65 | /** Scan memory for changed values and update search data. **/ 66 | /** Returns number of memory locations updated. **/ 67 | /*************************************************************/ 68 | int ScanHUNT(void); 69 | 70 | /** TotalHUNT() **********************************************/ 71 | /** Get total number of currently watched locations. **/ 72 | /*************************************************************/ 73 | int TotalHUNT(void); 74 | 75 | /** GetHUNT() ************************************************/ 76 | /** Get Nth memory location. Returns 0 for invalid N. **/ 77 | /*************************************************************/ 78 | HUNTEntry *GetHUNT(int N); 79 | 80 | /** HUNT2Cheat() *********************************************/ 81 | /** Create cheat code from Nth hunt entry. Returns 0 if the **/ 82 | /** entry is invalid. **/ 83 | /*************************************************************/ 84 | const char *HUNT2Cheat(int N,unsigned int Type); 85 | 86 | #endif /* HUNT_H */ 87 | -------------------------------------------------------------------------------- /src/EMULib/Record.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** Record.h **/ 4 | /** **/ 5 | /** This file contains routines for gameplay recording and **/ 6 | /** replay. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 2013-2019 **/ 9 | /** The contents of this file are property of Marat **/ 10 | /** Fayzullin and should only be used as agreed with **/ 11 | /** him. The file is confidential. Absolutely no **/ 12 | /** distribution allowed. **/ 13 | /*************************************************************/ 14 | #ifndef RECORD_H 15 | #define RECORD_H 16 | 17 | #include "EMULib.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /** RPLPlay()/RPLRecord() arguments **************************/ 24 | #define RPL_OFF 0xFFFFFFFF /* Disable */ 25 | #define RPL_ON 0xFFFFFFFE /* Enable */ 26 | #define RPL_TOGGLE 0xFFFFFFFD /* Toggle */ 27 | #define RPL_RESET 0xFFFFFFFC /* Reset and enable */ 28 | #define RPL_NEXT 0xFFFFFFFB /* Play the next record */ 29 | #define RPL_QUERY 0xFFFFFFFA /* Query state */ 30 | 31 | /** RPLPlay(RPL_NEXT) results ********************************/ 32 | #define RPL_ENDED 0xFFFFFFFF /* Finished or stopped */ 33 | 34 | /** RPLInit() ************************************************/ 35 | /** Initialize record/relay subsystem. **/ 36 | /*************************************************************/ 37 | void RPLInit(unsigned int (*SaveHandler)(unsigned char *,unsigned int),unsigned int (*LoadHandler)(unsigned char *,unsigned int),unsigned int MaxSize); 38 | 39 | /** RPLTrash() ***********************************************/ 40 | /** Free all record/replay resources. **/ 41 | /*************************************************************/ 42 | void RPLTrash(void); 43 | 44 | /** RPLRecord() **********************************************/ 45 | /** Record emulation state and joystick input for replaying **/ 46 | /** it back later. **/ 47 | /*************************************************************/ 48 | int RPLRecord(unsigned int JoyState); 49 | 50 | /** RPLRecordKeys() ******************************************/ 51 | /** Record emulation state, keys, and joystick input for **/ 52 | /** replaying them back later. **/ 53 | /*************************************************************/ 54 | int RPLRecordKeys(unsigned int JoyState,const unsigned char *Keys,unsigned int KeySize); 55 | 56 | /** RPLPlay() ************************************************/ 57 | /** Replay gameplay saved with RPLRecord(). **/ 58 | /*************************************************************/ 59 | unsigned int RPLPlay(int Cmd); 60 | 61 | /** RPLPlayKeys() ********************************************/ 62 | /** Replay gameplay saved with RPLRecordKeys(). **/ 63 | /*************************************************************/ 64 | unsigned int RPLPlayKeys(int Cmd,unsigned char *Keys,unsigned int KeySize); 65 | 66 | /** RPLCount() ***********************************************/ 67 | /** Compute the number of remaining replay records. **/ 68 | /*************************************************************/ 69 | unsigned int RPLCount(void); 70 | 71 | /** RPLShow() ************************************************/ 72 | /** Draw replay icon when active. **/ 73 | /*************************************************************/ 74 | void RPLShow(Image *Img,int X,int Y); 75 | 76 | /** SaveRPL() ************************************************/ 77 | /** Save gameplay recording into given file. **/ 78 | /*************************************************************/ 79 | int SaveRPL(const char *FileName); 80 | 81 | /** LoadRPL() ************************************************/ 82 | /** Load gameplay recording from given file. **/ 83 | /*************************************************************/ 84 | int LoadRPL(const char *FileName); 85 | 86 | /** RPLControls() ********************************************/ 87 | /** Let user browse through replay states with directional **/ 88 | /** buttons: LEFT:REW, RIGHT:FWD, DOWN:STOP, UP:CONTINUE. **/ 89 | /*************************************************************/ 90 | unsigned int RPLControls(unsigned int Buttons); 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | #endif /* RECORD_H */ 96 | -------------------------------------------------------------------------------- /src/EMULib/SN76489.c: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** SN76489.c **/ 4 | /** **/ 5 | /** This file contains emulation for the SN76489 sound chip **/ 6 | /** produced by Intel. See SN76489.h for declarations. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1996-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | 14 | #include "SN76489.h" 15 | #include "Sound.h" 16 | 17 | static const int Volumes[16] = 18 | { 255,203,161,128,102,81,64,51,40,32,25,20,16,13,10,0 }; 19 | 20 | static const int NoiseOUT[4] = { 14,15,14,14 }; 21 | static const int NoiseXOR[4] = { 13,12,10,13 }; 22 | 23 | /** Reset76489() *********************************************/ 24 | /** Reset the sound chip and use sound channels from the **/ 25 | /** one given in First. **/ 26 | /*************************************************************/ 27 | void Reset76489(SN76489 *D,int ClockHz,int First) 28 | { 29 | register int J; 30 | 31 | for(J=0;JVolume[J]=D->Freq[J]=0; 32 | 33 | D->Clock = ClockHz>>5; 34 | D->NoiseMode = (First&SN76489_MODE)|0x07; 35 | D->Buf = 0x00; 36 | D->Changed = 0x80|((1<Sync = SN76489_ASYNC; 38 | First &= ~SN76489_MODE; 39 | D->First = First; 40 | 41 | /* Set instruments */ 42 | SetSound(0+First,SND_MELODIC); 43 | SetSound(1+First,SND_MELODIC); 44 | SetSound(2+First,SND_MELODIC); 45 | SetSound(3+First,SND_NOISE); 46 | } 47 | 48 | /** Sync76489() **********************************************/ 49 | /** Flush all accumulated changes by issuing Sound() calls, **/ 50 | /** and set the synchronization on/off. The second argument **/ 51 | /** should be SN76489_SYNC, SN76489_ASYNC to set/reset sync **/ 52 | /** or SN76489_FLUSH to leave sync mode as it is. To play **/ 53 | /** noise channel with MIDI drums, OR second argument with **/ 54 | /** SN76489_DRUMS. **/ 55 | /*************************************************************/ 56 | void Sync76489(SN76489 *D,byte Sync) 57 | { 58 | register int J,I; 59 | 60 | /* Hit MIDI drums for noise channels, if requested */ 61 | if(Sync&SN76489_DRUMS) 62 | { 63 | if(D->Volume[3]&&D->Freq[3]) Drum(DRM_MIDI|28,D->Volume[3]); 64 | Sync&=~SN76489_DRUMS; 65 | } 66 | 67 | /* Set sync mode, if requested */ 68 | if(Sync!=SN76489_FLUSH) D->Sync=Sync; 69 | 70 | /* Update noise generator parameters */ 71 | if(D->Changed&0x80) 72 | { 73 | J=D->NoiseMode>>6; 74 | SetNoise(0x0001,NoiseOUT[J],D->NoiseMode&0x04? NoiseXOR[J]:NoiseOUT[J]+1); 75 | D->Changed&=0x7F; 76 | } 77 | 78 | /* Update channels */ 79 | for(J=0,I=D->Changed;I&&(J>=1) 80 | if(I&1) Sound(J+D->First,D->Freq[J],D->Volume[J]); 81 | 82 | /* Done */ 83 | D->Changed=0x00; 84 | } 85 | 86 | /** Write76489() *********************************************/ 87 | /** Call this function to output a value V into the sound **/ 88 | /** chip. **/ 89 | /*************************************************************/ 90 | void Write76489(SN76489 *D,byte V) 91 | { 92 | register byte N,J; 93 | register long L; 94 | 95 | switch(V&0xF0) 96 | { 97 | case 0xE0: 98 | /* Keep track of noise generator changes */ 99 | if((V^D->NoiseMode)&0x04) D->Changed|=0x80; 100 | /* Set noise period */ 101 | if((V^D->NoiseMode)&0x03) 102 | { 103 | J=V&0x03; 104 | D->Freq[3]=J==0x03? D->Freq[2]:D->Clock/(0x10<Changed|=0x08; 106 | } 107 | D->NoiseMode=(D->NoiseMode&~0x07)|(V&0x07); 108 | break; 109 | 110 | case 0x80: case 0xA0: case 0xC0: 111 | D->Buf=V; 112 | break; 113 | 114 | case 0x90: case 0xB0: case 0xD0: case 0xF0: 115 | N=(V-0x90)>>5; 116 | J=Volumes[V&0x0F]; 117 | if(J!=D->Volume[N]) 118 | { 119 | D->Volume[N]=J; 120 | D->Changed|=1<Buf&0xC0)) return; 126 | N=(D->Buf-0x80)>>5; 127 | L=D->Clock/(((int)(V&0x3F)<<4)+(D->Buf&0x0F)+1); 128 | /* Do not put upper limit on frequency here, since some */ 129 | /* games like it >15kHz (dynamite sound in Coleco HERO) */ 130 | if(L!=D->Freq[N]) 131 | { 132 | if((N==2)&&((D->NoiseMode&0x03)==0x03)) 133 | { 134 | D->Freq[3]=L; 135 | D->Changed|=0x08; 136 | } 137 | D->Freq[N]=L; 138 | D->Changed|=1<Sync&&D->Changed) Sync76489(D,SN76489_FLUSH); 145 | } 146 | -------------------------------------------------------------------------------- /src/EMULib/SN76489.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** SN76489.h **/ 4 | /** **/ 5 | /** This file contains emulation for the SN76489 sound chip **/ 6 | /** produced by Intel. See SN76489.c for the code. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1996-2019 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef SN76489_H 14 | #define SN76489_H 15 | #ifdef __cplusplus 16 | extern "C" { 17 | #endif 18 | 19 | #define SN76489_CHANNELS 4 /* Total number of channels */ 20 | 21 | #define SN76489_ASYNC 0 /* Asynchronous emulation */ 22 | #define SN76489_SYNC 1 /* Synchronous emulation */ 23 | #define SN76489_FLUSH 2 /* Flush buffers only */ 24 | #define SN76489_DRUMS 0x80 /* Hit drums for noise chnl */ 25 | 26 | #define SN76489_MODE 0xC0 /* Reset76489() mode bits */ 27 | #define SN76489_SG1000 0x00 /* Sega SG-1000 or SC-3000 */ 28 | #define SN76489_CV 0x00 /* ColecoVision (= SG-1000) */ 29 | #define SN76489_BBC 0x00 /* BBC Micro (= SG-1000) */ 30 | #define SN76489_SMS 0x40 /* Sega MasterSystem */ 31 | #define SN76489_GG 0x40 /* Sega GameGear (= SMS) */ 32 | #define SN76489_TANDY 0x80 /* Tandy 1000 */ 33 | 34 | #ifndef BYTE_TYPE_DEFINED 35 | #define BYTE_TYPE_DEFINED 36 | typedef unsigned char byte; 37 | #endif 38 | 39 | /** SN76489 **************************************************/ 40 | /** This data structure stores SN76489 state. **/ 41 | /*************************************************************/ 42 | #pragma pack(4) 43 | typedef struct 44 | { 45 | int Clock; /* Base clock rate (Fin/32) */ 46 | int Freq[SN76489_CHANNELS]; /* Frequencies (0 for off) */ 47 | int Volume[SN76489_CHANNELS]; /* Volumes (0..255) */ 48 | byte Sync; /* Sync mode */ 49 | byte NoiseMode; /* Noise mode */ 50 | byte Buf; /* Latch to store a value */ 51 | byte Changed; /* Bitmap of changed channels */ 52 | int First; /* First used Sound() channel */ 53 | } SN76489; 54 | #pragma pack() 55 | 56 | /** Reset76489() *********************************************/ 57 | /** Reset the sound chip and use sound channels from the **/ 58 | /** one given in First. **/ 59 | /*************************************************************/ 60 | void Reset76489(register SN76489 *D,int ClockHz,int First); 61 | 62 | /** Sync76489() **********************************************/ 63 | /** Flush all accumulated changes by issuing Sound() calls, **/ 64 | /** and set the synchronization on/off. The second argument **/ 65 | /** should be SN76489_SYNC, SN76489_ASYNC to set/reset sync **/ 66 | /** or SN76489_FLUSH to leave sync mode as it is. To play **/ 67 | /** noise channel with MIDI drums, OR second argument with **/ 68 | /** SN76489_DRUMS. **/ 69 | /*************************************************************/ 70 | void Sync76489(register SN76489 *D,register byte Sync); 71 | 72 | /** Write76489() *********************************************/ 73 | /** Call this function to output a value V into the sound **/ 74 | /** chip. **/ 75 | /*************************************************************/ 76 | void Write76489(register SN76489 *D,register byte V); 77 | 78 | #ifdef __cplusplus 79 | } 80 | #endif 81 | #endif /* SN76489_H */ 82 | -------------------------------------------------------------------------------- /src/EMULib/Sound.h: -------------------------------------------------------------------------------- 1 | /** EMULib Emulation Library *********************************/ 2 | /** **/ 3 | /** Sound.h **/ 4 | /** **/ 5 | /** This file defines standard sound generation API and **/ 6 | /** functions needed to log soundtrack into a MIDI file. **/ 7 | /** See Sound.c and the sound drivers for the code. **/ 8 | /** **/ 9 | /** Copyright (C) Marat Fayzullin 1996-2019 **/ 10 | /** You are not allowed to distribute this software **/ 11 | /** commercially. Please, notify me, if you make any **/ 12 | /** changes to this file. **/ 13 | /*************************************************************/ 14 | #ifndef SOUND_H 15 | #define SOUND_H 16 | 17 | #include "EMULib.h" 18 | 19 | #ifdef __cplusplus 20 | extern "C" { 21 | #endif 22 | 23 | /* SetSound() arguments: */ 24 | #define SND_MELODIC 0 /* Melodic sound (default) */ 25 | #define SND_RECTANGLE 0 /* Rectangular wave */ 26 | #define SND_TRIANGLE 1 /* Triangular wave (1/2 rect.)*/ 27 | #define SND_NOISE 2 /* White noise */ 28 | #define SND_PERIODIC 3 /* Periodic noise (not im-ed) */ 29 | #define SND_WAVE 4 /* Wave sound set by SetWave()*/ 30 | #define SND_MIDI 0x100 /* MIDI instrument (ORable) */ 31 | 32 | /* Drum() arguments: */ 33 | #define DRM_CLICK 0 /* Click (default) */ 34 | #define DRM_MIDI 0x100 /* MIDI drum (ORable) */ 35 | 36 | /* MIDI characteristics: */ 37 | #define MIDI_CHANNELS 16 /* Number of MIDI channels */ 38 | #define MIDI_MINFREQ 9 /* Min MIDI frequency (Hz) */ 39 | #define MIDI_MAXFREQ 12285 /* Max MIDI frequency (Hz) */ 40 | #define MIDI_DIVISIONS 1000 /* Number of ticks per second */ 41 | 42 | /* MIDILogging() arguments: */ 43 | #define MIDI_OFF 0 /* Turn MIDI logging off */ 44 | #define MIDI_ON 1 /* Turn MIDI logging on */ 45 | #define MIDI_TOGGLE 2 /* Toggle MIDI logging */ 46 | #define MIDI_QUERY 3 /* Query MIDI logging status */ 47 | 48 | /** InitSound() **********************************************/ 49 | /** Initialize RenderSound() with given parameters. **/ 50 | /*************************************************************/ 51 | unsigned int InitSound(unsigned int Rate,unsigned int Latency); 52 | 53 | /** TrashSound() *********************************************/ 54 | /** Shut down RenderSound() driver. **/ 55 | /*************************************************************/ 56 | void TrashSound(void); 57 | 58 | /** RenderAudio() ********************************************/ 59 | /** Render given number of melodic sound samples into an **/ 60 | /** integer buffer for mixing. **/ 61 | /*************************************************************/ 62 | void RenderAudio(int *Wave,unsigned int Samples); 63 | 64 | /** PlayAudio() **********************************************/ 65 | /** Normalize and play given number of samples from the mix **/ 66 | /** buffer. Returns the number of samples actually played. **/ 67 | /*************************************************************/ 68 | unsigned int PlayAudio(int *Wave,unsigned int Samples); 69 | 70 | /** RenderAndPlayAudio() *************************************/ 71 | /** Render and play a given number of samples. Returns the **/ 72 | /** number of samples actually played. **/ 73 | /*************************************************************/ 74 | unsigned int RenderAndPlayAudio(unsigned int Samples); 75 | 76 | /** Sound() **************************************************/ 77 | /** Generate sound of given frequency (Hz) and volume **/ 78 | /** (0..255) via given channel. Setting Freq=0 or Volume=0 **/ 79 | /** turns sound off. **/ 80 | /*************************************************************/ 81 | void Sound(int Channel,int Freq,int Volume); 82 | 83 | /** Drum() ***************************************************/ 84 | /** Hit a drum of given type with given force (0..255). **/ 85 | /** MIDI drums can be used by ORing their numbers with **/ 86 | /** SND_MIDI. **/ 87 | /*************************************************************/ 88 | void Drum(int Type,int Force); 89 | 90 | /** SetSound() ***********************************************/ 91 | /** Set sound type at a given channel. MIDI instruments can **/ 92 | /** be set directly by ORing their numbers with SND_MIDI. **/ 93 | /*************************************************************/ 94 | void SetSound(int Channel,int NewType); 95 | 96 | /** SetChannels() ********************************************/ 97 | /** Set master volume (0..255) and switch channels on/off. **/ 98 | /** Each channel N has corresponding bit 2^N in Switch. Set **/ 99 | /** or reset this bit to turn the channel on or off. **/ 100 | /*************************************************************/ 101 | void SetChannels(int Volume,int Switch); 102 | 103 | /** SetNoise() ***********************************************/ 104 | /** Initialize random noise generator to the given Seed and **/ 105 | /** then take random output from OUTBit and XOR it with **/ 106 | /** XORBit. **/ 107 | /*************************************************************/ 108 | void SetNoise(int Seed,int OUTBit,int XORBit); 109 | 110 | /** SetWave() ************************************************/ 111 | /** Set waveform for a given channel. The channel will be **/ 112 | /** marked with sound type SND_WAVE. Set Rate=0 if you want **/ 113 | /** waveform to be an instrument or set it to the waveform **/ 114 | /** own playback rate. **/ 115 | /*************************************************************/ 116 | void SetWave(int Channel,const signed char *Data,int Length,int Rate); 117 | 118 | /** GetWave() ************************************************/ 119 | /** Get current read position for the buffer set with the **/ 120 | /** SetWave() call. Returns 0 if no buffer has been set, or **/ 121 | /** if there is no playrate set (i.e. wave is instrument). **/ 122 | /*************************************************************/ 123 | const signed char *GetWave(int Channel); 124 | 125 | /** GetSndRate() *********************************************/ 126 | /** Get current sampling rate used for synthesis. **/ 127 | /*************************************************************/ 128 | unsigned int GetSndRate(void); 129 | 130 | /** InitMIDI() ***********************************************/ 131 | /** Initialize soundtrack logging into MIDI file FileName. **/ 132 | /** Repeated calls to InitMIDI() will close current MIDI **/ 133 | /** file and continue logging into a new one. **/ 134 | /*************************************************************/ 135 | void InitMIDI(const char *FileName); 136 | 137 | /** TrashMIDI() **********************************************/ 138 | /** Finish logging soundtrack and close the MIDI file. **/ 139 | /*************************************************************/ 140 | void TrashMIDI(void); 141 | 142 | /** MIDILogging() ********************************************/ 143 | /** Turn soundtrack logging on/off and return its current **/ 144 | /** status. Possible values of Switch are MIDI_OFF (turn **/ 145 | /** logging off), MIDI_ON (turn logging on), MIDI_TOGGLE **/ 146 | /** (toggle logging), and MIDI_QUERY (just return current **/ 147 | /** state of logging). **/ 148 | /*************************************************************/ 149 | int MIDILogging(int Switch); 150 | 151 | /** MIDITicks() **********************************************/ 152 | /** Log N 1ms MIDI ticks. **/ 153 | /*************************************************************/ 154 | void MIDITicks(int N); 155 | 156 | #if !defined(MSDOS) & !defined(UNIX) & !defined(MAEMO) & !defined(WINDOWS) & !defined(S60) & !defined(UIQ) && !defined(ANDROID) 157 | #define SND_CHANNELS MIDI_CHANNELS /* Default number */ 158 | #endif 159 | 160 | /** SndDriver ************************************************/ 161 | /** Each sound driver should fill this structure with **/ 162 | /** pointers to hardware-dependent handlers. This has to be **/ 163 | /** done inside the InitSound() function. **/ 164 | /*************************************************************/ 165 | struct SndDriverStruct 166 | { 167 | void (*SetSound)(int Channel,int NewType); 168 | void (*Drum)(int Type,int Force); 169 | void (*SetChannels)(int Volume,int Switch); 170 | void (*Sound)(int Channel,int NewFreq,int NewVolume); 171 | void (*SetWave)(int Channel,const signed char *Data,int Length,int Freq); 172 | const signed char *(*GetWave)(int Channel); 173 | }; 174 | extern struct SndDriverStruct SndDriver; 175 | 176 | #ifdef __cplusplus 177 | } 178 | #endif 179 | #endif /* SOUND_H */ 180 | -------------------------------------------------------------------------------- /src/EMULib/Wii/LibWii.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | /** EMULib Emulation Library *********************************/ 30 | /** **/ 31 | /** LibWii.h **/ 32 | /** **/ 33 | /** This file contains Wii-dependent definitions and **/ 34 | /** declarations for the emulation library. **/ 35 | /** **/ 36 | /** Copyright (C) Marat Fayzullin 1996-2008 **/ 37 | /** You are not allowed to distribute this software **/ 38 | /** commercially. Please, notify me, if you make any **/ 39 | /** changes to this file. **/ 40 | /*************************************************************/ 41 | 42 | #ifndef LIBWII_H 43 | #define LIBWII_H 44 | 45 | #ifdef __cplusplus 46 | extern "C" { 47 | #endif 48 | 49 | /** InitAudio() **********************************************/ 50 | /** Initialize sound. Returns rate (Hz) on success, else 0. **/ 51 | /** Rate=0 to skip initialization (will be silent). The **/ 52 | /** Delay value is given in millseconds and determines how **/ 53 | /** much buffering will be done. **/ 54 | /*************************************************************/ 55 | unsigned int InitAudio(unsigned int Rate, unsigned int Delay); 56 | 57 | /** TrashAudio() *********************************************/ 58 | /** Free resources allocated by InitAudio(). **/ 59 | /*************************************************************/ 60 | void TrashAudio(void); 61 | 62 | #ifdef __cplusplus 63 | } 64 | #endif 65 | #endif /* LIBWII_H */ 66 | -------------------------------------------------------------------------------- /src/EMULib/Wii/SndSDL.c: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | /** EMULib Emulation Library *********************************/ 30 | /** **/ 31 | /** SndSDL.c **/ 32 | /** **/ 33 | /** This file contains SDL-dependent sound implementation **/ 34 | /** for the emulation library. **/ 35 | /** **/ 36 | /** Copyright (C) Marat Fayzullin 1996-2008 **/ 37 | /** You are not allowed to distribute this software **/ 38 | /** commercially. Please, notify me, if you make any **/ 39 | /** changes to this file. **/ 40 | /*************************************************************/ 41 | 42 | #include "EMULib.h" 43 | #include "LibWii.h" 44 | #include "Sound.h" 45 | 46 | #include 47 | #include "wii_types.h" 48 | 49 | #include "SDL.h" 50 | 51 | static int SndRate = 0; /* Audio sampling rate */ 52 | static int SndSize = 0; /* SndData[] size */ 53 | static sample* SndData = 0; /* Audio buffers */ 54 | static int RPtr = 0; /* Read pointer into Bufs */ 55 | static int WPtr = 0; /* Write pointer into Bufs */ 56 | static volatile int AudioPaused = 0; /* 1: Audio paused */ 57 | 58 | /** AudioHandler() *******************************************/ 59 | /** Callback invoked by SDL to play audio. **/ 60 | /*************************************************************/ 61 | void AudioHandler(void* UserData, Uint8* StreamIn, int Length) { 62 | int J; 63 | sample* Stream = (sample*)StreamIn; 64 | 65 | /* Need to have valid playback rate */ 66 | if (!SndRate) 67 | return; 68 | 69 | /* Recompute length in samples */ 70 | Length /= sizeof(sample); 71 | 72 | /* Copy audio data */ 73 | for (J = 0; J < Length; J += 2) { 74 | Stream[J] = SndData[RPtr]; 75 | Stream[J + 1] = SndData[RPtr]; 76 | RPtr = RPtr < SndSize - 1 ? RPtr + 1 : 0; 77 | } 78 | } 79 | 80 | /** InitAudio() **********************************************/ 81 | /** Initialize sound. Returns rate (Hz) on success, else 0. **/ 82 | /** Rate=0 to skip initialization (will be silent). **/ 83 | /*************************************************************/ 84 | unsigned int InitAudio(unsigned int Rate, unsigned int Latency) { 85 | SDL_AudioSpec AudioFormat; 86 | int J; 87 | 88 | /* Shut down audio, just to be sure */ 89 | TrashAudio(); 90 | SndRate = 0; 91 | SndSize = 0; 92 | SndData = 0; 93 | RPtr = 0; 94 | WPtr = 0; 95 | AudioPaused = 0; 96 | 97 | /* Have to have at least 8kHz sampling rate and 1ms buffer */ 98 | if ((Rate < 8000) || !Latency) 99 | return (0); 100 | 101 | /* Compute number of sound buffers */ 102 | SndSize = Rate * Latency / 1000; 103 | 104 | /* Allocate audio buffers */ 105 | SndData = (sample*)malloc(SndSize * sizeof(sample)); 106 | 107 | if (!SndData) 108 | return (0); 109 | 110 | /* Set SDL audio settings */ 111 | AudioFormat.freq = Rate; 112 | AudioFormat.format = AUDIO_S16MSB; 113 | AudioFormat.channels = 2; 114 | AudioFormat.samples = SndSize << 1; 115 | AudioFormat.callback = AudioHandler; 116 | AudioFormat.userdata = 0; 117 | 118 | /* Open SDL audio device */ 119 | if (SDL_OpenAudio(&AudioFormat, 0) < 0) { 120 | free(SndData); 121 | SndData = 0; 122 | return (0); 123 | } 124 | 125 | /* Clear audio buffers */ 126 | for (J = 0; J < SndSize; ++J) 127 | SndData[J] = 0; 128 | 129 | /* Callback expects valid SndRate!=0 at the start */ 130 | SndRate = Rate; 131 | 132 | /* Start playing SDL audio */ 133 | SDL_PauseAudio(0); 134 | 135 | /* Done, return effective audio rate */ 136 | return (SndRate); 137 | } 138 | 139 | /** TrashAudio() *********************************************/ 140 | /** Free resources allocated by InitAudio(). **/ 141 | /*************************************************************/ 142 | void TrashAudio(void) { 143 | /* Sound off, pause off */ 144 | SndRate = 0; 145 | AudioPaused = 0; 146 | 147 | /* Audio off */ 148 | SDL_CloseAudio(); 149 | 150 | /* If buffers were allocated... */ 151 | if (SndData) 152 | free(SndData); 153 | 154 | /* Sound trashed */ 155 | SndData = 0; 156 | SndSize = 0; 157 | RPtr = 0; 158 | WPtr = 0; 159 | } 160 | 161 | /** PauseAudio() *********************************************/ 162 | /** Pause/resume audio playback. **/ 163 | /*************************************************************/ 164 | int PauseAudio(int Switch) { 165 | /* Toggle audio status if requested */ 166 | if (Switch == 2) 167 | Switch = AudioPaused ? 0 : 1; 168 | 169 | /* When switching audio state... */ 170 | if ((Switch >= 0) && (Switch <= 1) && (Switch != AudioPaused)) { 171 | /* Pause/Resume SDL audio */ 172 | SDL_PauseAudio(Switch); 173 | /* Audio switched */ 174 | AudioPaused = Switch; 175 | } 176 | 177 | /* Return current status */ 178 | return (AudioPaused); 179 | } 180 | 181 | /** GetFreeAudio() *******************************************/ 182 | /** Get the amount of free samples in the audio buffer. **/ 183 | /*************************************************************/ 184 | unsigned int GetFreeAudio(void) { 185 | return (!SndRate ? 0 : RPtr >= WPtr ? RPtr - WPtr : RPtr - WPtr + SndSize); 186 | } 187 | 188 | /** WriteAudio() *********************************************/ 189 | /** Write up to a given number of samples to audio buffer. **/ 190 | /** Returns the number of samples written. **/ 191 | /*************************************************************/ 192 | unsigned int WriteAudio(sample* Data, unsigned int Length) { 193 | unsigned int J; 194 | 195 | /* Require audio to be initialized */ 196 | if (!SndRate) 197 | return (0); 198 | 199 | /* Copy audio samples */ 200 | for (J = 0; (J < Length) && (RPtr != WPtr); ++J) { 201 | SndData[WPtr++] = Data[J]; 202 | if (WPtr >= SndSize) 203 | WPtr = 0; 204 | } 205 | 206 | /* Return number of samples copied */ 207 | return (J); 208 | } 209 | 210 | /** ResetAudio() *********************************************/ 211 | /** Resets the audio buffers. **/ 212 | /*************************************************************/ 213 | void ResetAudio() { 214 | unsigned int J; 215 | RPtr = 0; 216 | WPtr = 0; 217 | if (SndData) { 218 | /* Clear audio buffers */ 219 | for (J = 0; J < SndSize; ++J) 220 | SndData[J] = 0; 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /src/Z80/CodesED.h: -------------------------------------------------------------------------------- 1 | /** Z80: portable Z80 emulator *******************************/ 2 | /** **/ 3 | /** CodesED.h **/ 4 | /** **/ 5 | /** This file contains implementation for the ED table of **/ 6 | /** Z80 commands. It is included from Z80.c. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2018 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | 14 | /** This is a special patch for emulating BIOS calls: ********/ 15 | case DB_FE: PatchZ80(R);break; 16 | /*************************************************************/ 17 | 18 | case ADC_HL_BC: M_ADCW(BC);break; 19 | case ADC_HL_DE: M_ADCW(DE);break; 20 | case ADC_HL_HL: M_ADCW(HL);break; 21 | case ADC_HL_SP: M_ADCW(SP);break; 22 | 23 | case SBC_HL_BC: M_SBCW(BC);break; 24 | case SBC_HL_DE: M_SBCW(DE);break; 25 | case SBC_HL_HL: M_SBCW(HL);break; 26 | case SBC_HL_SP: M_SBCW(SP);break; 27 | 28 | case LD_xWORDe_HL: 29 | J.B.l=OpZ80(R->PC.W++); 30 | J.B.h=OpZ80(R->PC.W++); 31 | WrZ80(J.W++,R->HL.B.l); 32 | WrZ80(J.W,R->HL.B.h); 33 | break; 34 | case LD_xWORDe_DE: 35 | J.B.l=OpZ80(R->PC.W++); 36 | J.B.h=OpZ80(R->PC.W++); 37 | WrZ80(J.W++,R->DE.B.l); 38 | WrZ80(J.W,R->DE.B.h); 39 | break; 40 | case LD_xWORDe_BC: 41 | J.B.l=OpZ80(R->PC.W++); 42 | J.B.h=OpZ80(R->PC.W++); 43 | WrZ80(J.W++,R->BC.B.l); 44 | WrZ80(J.W,R->BC.B.h); 45 | break; 46 | case LD_xWORDe_SP: 47 | J.B.l=OpZ80(R->PC.W++); 48 | J.B.h=OpZ80(R->PC.W++); 49 | WrZ80(J.W++,R->SP.B.l); 50 | WrZ80(J.W,R->SP.B.h); 51 | break; 52 | 53 | case LD_HL_xWORDe: 54 | J.B.l=OpZ80(R->PC.W++); 55 | J.B.h=OpZ80(R->PC.W++); 56 | R->HL.B.l=RdZ80(J.W++); 57 | R->HL.B.h=RdZ80(J.W); 58 | break; 59 | case LD_DE_xWORDe: 60 | J.B.l=OpZ80(R->PC.W++); 61 | J.B.h=OpZ80(R->PC.W++); 62 | R->DE.B.l=RdZ80(J.W++); 63 | R->DE.B.h=RdZ80(J.W); 64 | break; 65 | case LD_BC_xWORDe: 66 | J.B.l=OpZ80(R->PC.W++); 67 | J.B.h=OpZ80(R->PC.W++); 68 | R->BC.B.l=RdZ80(J.W++); 69 | R->BC.B.h=RdZ80(J.W); 70 | break; 71 | case LD_SP_xWORDe: 72 | J.B.l=OpZ80(R->PC.W++); 73 | J.B.h=OpZ80(R->PC.W++); 74 | R->SP.B.l=RdZ80(J.W++); 75 | R->SP.B.h=RdZ80(J.W); 76 | break; 77 | 78 | case RRD: 79 | I=RdZ80(R->HL.W); 80 | J.B.l=(I>>4)|(R->AF.B.h<<4); 81 | WrZ80(R->HL.W,J.B.l); 82 | R->AF.B.h=(I&0x0F)|(R->AF.B.h&0xF0); 83 | R->AF.B.l=PZSTable[R->AF.B.h]|(R->AF.B.l&C_FLAG); 84 | break; 85 | case RLD: 86 | I=RdZ80(R->HL.W); 87 | J.B.l=(I<<4)|(R->AF.B.h&0x0F); 88 | WrZ80(R->HL.W,J.B.l); 89 | R->AF.B.h=(I>>4)|(R->AF.B.h&0xF0); 90 | R->AF.B.l=PZSTable[R->AF.B.h]|(R->AF.B.l&C_FLAG); 91 | break; 92 | 93 | case LD_A_I: 94 | R->AF.B.h=R->I; 95 | R->AF.B.l=(R->AF.B.l&C_FLAG)|(R->IFF&IFF_2? P_FLAG:0)|ZSTable[R->AF.B.h]; 96 | break; 97 | 98 | case LD_A_R: 99 | R->AF.B.h=R->R; 100 | R->AF.B.l=(R->AF.B.l&C_FLAG)|(R->IFF&IFF_2? P_FLAG:0)|ZSTable[R->AF.B.h]; 101 | break; 102 | 103 | case LD_I_A: R->I=R->AF.B.h;break; 104 | case LD_R_A: R->R=R->AF.B.h;break; 105 | 106 | case IM_0: R->IFF&=~(IFF_IM1|IFF_IM2);break; 107 | case IM_1: R->IFF=(R->IFF&~IFF_IM2)|IFF_IM1;break; 108 | case IM_2: R->IFF=(R->IFF&~IFF_IM1)|IFF_IM2;break; 109 | 110 | case RETI: 111 | case RETN: if(R->IFF&IFF_2) R->IFF|=IFF_1; else R->IFF&=~IFF_1; 112 | M_RET;break; 113 | 114 | case NEG: I=R->AF.B.h;R->AF.B.h=0;M_SUB(I);break; 115 | 116 | case IN_B_xC: M_IN(R->BC.B.h);break; 117 | case IN_C_xC: M_IN(R->BC.B.l);break; 118 | case IN_D_xC: M_IN(R->DE.B.h);break; 119 | case IN_E_xC: M_IN(R->DE.B.l);break; 120 | case IN_H_xC: M_IN(R->HL.B.h);break; 121 | case IN_L_xC: M_IN(R->HL.B.l);break; 122 | case IN_A_xC: M_IN(R->AF.B.h);break; 123 | case IN_F_xC: M_IN(J.B.l);break; 124 | 125 | case OUT_xC_B: OutZ80(R->BC.W,R->BC.B.h);break; 126 | case OUT_xC_C: OutZ80(R->BC.W,R->BC.B.l);break; 127 | case OUT_xC_D: OutZ80(R->BC.W,R->DE.B.h);break; 128 | case OUT_xC_E: OutZ80(R->BC.W,R->DE.B.l);break; 129 | case OUT_xC_H: OutZ80(R->BC.W,R->HL.B.h);break; 130 | case OUT_xC_L: OutZ80(R->BC.W,R->HL.B.l);break; 131 | case OUT_xC_A: OutZ80(R->BC.W,R->AF.B.h);break; 132 | case OUT_xC_F: OutZ80(R->BC.W,0);break; 133 | 134 | case INI: 135 | WrZ80(R->HL.W++,InZ80(R->BC.W)); 136 | --R->BC.B.h; 137 | R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG); 138 | break; 139 | 140 | case INIR: 141 | WrZ80(R->HL.W++,InZ80(R->BC.W)); 142 | if(--R->BC.B.h) { R->AF.B.l=N_FLAG;R->ICount-=21;R->PC.W-=2; } 143 | else { R->AF.B.l=Z_FLAG|N_FLAG;R->ICount-=16; } 144 | break; 145 | 146 | case IND: 147 | WrZ80(R->HL.W--,InZ80(R->BC.W)); 148 | --R->BC.B.h; 149 | R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG); 150 | break; 151 | 152 | case INDR: 153 | WrZ80(R->HL.W--,InZ80(R->BC.W)); 154 | if(!--R->BC.B.h) { R->AF.B.l=N_FLAG;R->ICount-=21;R->PC.W-=2; } 155 | else { R->AF.B.l=Z_FLAG|N_FLAG;R->ICount-=16; } 156 | break; 157 | 158 | case OUTI: 159 | --R->BC.B.h; 160 | I=RdZ80(R->HL.W++); 161 | OutZ80(R->BC.W,I); 162 | R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG)|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 163 | break; 164 | 165 | case OTIR: 166 | --R->BC.B.h; 167 | I=RdZ80(R->HL.W++); 168 | OutZ80(R->BC.W,I); 169 | if(R->BC.B.h) 170 | { 171 | R->AF.B.l=N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 172 | R->ICount-=21; 173 | R->PC.W-=2; 174 | } 175 | else 176 | { 177 | R->AF.B.l=Z_FLAG|N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 178 | R->ICount-=16; 179 | } 180 | break; 181 | 182 | case OUTD: 183 | --R->BC.B.h; 184 | I=RdZ80(R->HL.W--); 185 | OutZ80(R->BC.W,I); 186 | R->AF.B.l=N_FLAG|(R->BC.B.h? 0:Z_FLAG)|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 187 | break; 188 | 189 | case OTDR: 190 | --R->BC.B.h; 191 | I=RdZ80(R->HL.W--); 192 | OutZ80(R->BC.W,I); 193 | if(R->BC.B.h) 194 | { 195 | R->AF.B.l=N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 196 | R->ICount-=21; 197 | R->PC.W-=2; 198 | } 199 | else 200 | { 201 | R->AF.B.l=Z_FLAG|N_FLAG|(R->HL.B.l+I>255? (C_FLAG|H_FLAG):0); 202 | R->ICount-=16; 203 | } 204 | break; 205 | 206 | case LDI: 207 | WrZ80(R->DE.W++,RdZ80(R->HL.W++)); 208 | --R->BC.W; 209 | R->AF.B.l=(R->AF.B.l&~(N_FLAG|H_FLAG|P_FLAG))|(R->BC.W? P_FLAG:0); 210 | break; 211 | 212 | case LDIR: 213 | WrZ80(R->DE.W++,RdZ80(R->HL.W++)); 214 | if(--R->BC.W) 215 | { 216 | R->AF.B.l=(R->AF.B.l&~(H_FLAG|P_FLAG))|N_FLAG; 217 | R->ICount-=21; 218 | R->PC.W-=2; 219 | } 220 | else 221 | { 222 | R->AF.B.l&=~(N_FLAG|H_FLAG|P_FLAG); 223 | R->ICount-=16; 224 | } 225 | break; 226 | 227 | case LDD: 228 | WrZ80(R->DE.W--,RdZ80(R->HL.W--)); 229 | --R->BC.W; 230 | R->AF.B.l=(R->AF.B.l&~(N_FLAG|H_FLAG|P_FLAG))|(R->BC.W? P_FLAG:0); 231 | break; 232 | 233 | case LDDR: 234 | WrZ80(R->DE.W--,RdZ80(R->HL.W--)); 235 | R->AF.B.l&=~(N_FLAG|H_FLAG|P_FLAG); 236 | if(--R->BC.W) 237 | { 238 | R->AF.B.l=(R->AF.B.l&~(H_FLAG|P_FLAG))|N_FLAG; 239 | R->ICount-=21; 240 | R->PC.W-=2; 241 | } 242 | else 243 | { 244 | R->AF.B.l&=~(N_FLAG|H_FLAG|P_FLAG); 245 | R->ICount-=16; 246 | } 247 | break; 248 | 249 | case CPI: 250 | I=RdZ80(R->HL.W++); 251 | J.B.l=R->AF.B.h-I; 252 | --R->BC.W; 253 | R->AF.B.l = 254 | N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| 255 | ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); 256 | break; 257 | 258 | case CPIR: 259 | I=RdZ80(R->HL.W++); 260 | J.B.l=R->AF.B.h-I; 261 | if(--R->BC.W&&J.B.l) { R->ICount-=21;R->PC.W-=2; } else R->ICount-=16; 262 | R->AF.B.l = 263 | N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| 264 | ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); 265 | break; 266 | 267 | case CPD: 268 | I=RdZ80(R->HL.W--); 269 | J.B.l=R->AF.B.h-I; 270 | --R->BC.W; 271 | R->AF.B.l = 272 | N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| 273 | ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); 274 | break; 275 | 276 | case CPDR: 277 | I=RdZ80(R->HL.W--); 278 | J.B.l=R->AF.B.h-I; 279 | if(--R->BC.W&&J.B.l) { R->ICount-=21;R->PC.W-=2; } else R->ICount-=16; 280 | R->AF.B.l = 281 | N_FLAG|(R->AF.B.l&C_FLAG)|ZSTable[J.B.l]| 282 | ((R->AF.B.h^I^J.B.l)&H_FLAG)|(R->BC.W? P_FLAG:0); 283 | break; 284 | -------------------------------------------------------------------------------- /src/Z80/CodesXCB.h: -------------------------------------------------------------------------------- 1 | /** Z80: portable Z80 emulator *******************************/ 2 | /** **/ 3 | /** CodesXCB.h **/ 4 | /** **/ 5 | /** This file contains implementation for FD/DD-CB tables **/ 6 | /** of Z80 commands. It is included from Z80.c. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2018 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | 14 | case RLC_xHL: I=RdZ80(J.W);M_RLC(I);WrZ80(J.W,I);break; 15 | case RRC_xHL: I=RdZ80(J.W);M_RRC(I);WrZ80(J.W,I);break; 16 | case RL_xHL: I=RdZ80(J.W);M_RL(I);WrZ80(J.W,I);break; 17 | case RR_xHL: I=RdZ80(J.W);M_RR(I);WrZ80(J.W,I);break; 18 | case SLA_xHL: I=RdZ80(J.W);M_SLA(I);WrZ80(J.W,I);break; 19 | case SRA_xHL: I=RdZ80(J.W);M_SRA(I);WrZ80(J.W,I);break; 20 | case SLL_xHL: I=RdZ80(J.W);M_SLL(I);WrZ80(J.W,I);break; 21 | case SRL_xHL: I=RdZ80(J.W);M_SRL(I);WrZ80(J.W,I);break; 22 | 23 | case BIT0_B: case BIT0_C: case BIT0_D: case BIT0_E: 24 | case BIT0_H: case BIT0_L: case BIT0_A: 25 | case BIT0_xHL: I=RdZ80(J.W);M_BIT(0,I);break; 26 | case BIT1_B: case BIT1_C: case BIT1_D: case BIT1_E: 27 | case BIT1_H: case BIT1_L: case BIT1_A: 28 | case BIT1_xHL: I=RdZ80(J.W);M_BIT(1,I);break; 29 | case BIT2_B: case BIT2_C: case BIT2_D: case BIT2_E: 30 | case BIT2_H: case BIT2_L: case BIT2_A: 31 | case BIT2_xHL: I=RdZ80(J.W);M_BIT(2,I);break; 32 | case BIT3_B: case BIT3_C: case BIT3_D: case BIT3_E: 33 | case BIT3_H: case BIT3_L: case BIT3_A: 34 | case BIT3_xHL: I=RdZ80(J.W);M_BIT(3,I);break; 35 | case BIT4_B: case BIT4_C: case BIT4_D: case BIT4_E: 36 | case BIT4_H: case BIT4_L: case BIT4_A: 37 | case BIT4_xHL: I=RdZ80(J.W);M_BIT(4,I);break; 38 | case BIT5_B: case BIT5_C: case BIT5_D: case BIT5_E: 39 | case BIT5_H: case BIT5_L: case BIT5_A: 40 | case BIT5_xHL: I=RdZ80(J.W);M_BIT(5,I);break; 41 | case BIT6_B: case BIT6_C: case BIT6_D: case BIT6_E: 42 | case BIT6_H: case BIT6_L: case BIT6_A: 43 | case BIT6_xHL: I=RdZ80(J.W);M_BIT(6,I);break; 44 | case BIT7_B: case BIT7_C: case BIT7_D: case BIT7_E: 45 | case BIT7_H: case BIT7_L: case BIT7_A: 46 | case BIT7_xHL: I=RdZ80(J.W);M_BIT(7,I);break; 47 | 48 | case RES0_xHL: I=RdZ80(J.W);M_RES(0,I);WrZ80(J.W,I);break; 49 | case RES1_xHL: I=RdZ80(J.W);M_RES(1,I);WrZ80(J.W,I);break; 50 | case RES2_xHL: I=RdZ80(J.W);M_RES(2,I);WrZ80(J.W,I);break; 51 | case RES3_xHL: I=RdZ80(J.W);M_RES(3,I);WrZ80(J.W,I);break; 52 | case RES4_xHL: I=RdZ80(J.W);M_RES(4,I);WrZ80(J.W,I);break; 53 | case RES5_xHL: I=RdZ80(J.W);M_RES(5,I);WrZ80(J.W,I);break; 54 | case RES6_xHL: I=RdZ80(J.W);M_RES(6,I);WrZ80(J.W,I);break; 55 | case RES7_xHL: I=RdZ80(J.W);M_RES(7,I);WrZ80(J.W,I);break; 56 | 57 | case SET0_xHL: I=RdZ80(J.W);M_SET(0,I);WrZ80(J.W,I);break; 58 | case SET1_xHL: I=RdZ80(J.W);M_SET(1,I);WrZ80(J.W,I);break; 59 | case SET2_xHL: I=RdZ80(J.W);M_SET(2,I);WrZ80(J.W,I);break; 60 | case SET3_xHL: I=RdZ80(J.W);M_SET(3,I);WrZ80(J.W,I);break; 61 | case SET4_xHL: I=RdZ80(J.W);M_SET(4,I);WrZ80(J.W,I);break; 62 | case SET5_xHL: I=RdZ80(J.W);M_SET(5,I);WrZ80(J.W,I);break; 63 | case SET6_xHL: I=RdZ80(J.W);M_SET(6,I);WrZ80(J.W,I);break; 64 | case SET7_xHL: I=RdZ80(J.W);M_SET(7,I);WrZ80(J.W,I);break; 65 | -------------------------------------------------------------------------------- /src/Z80/ConDebug.c: -------------------------------------------------------------------------------- 1 | /** Z80: portable Z80 emulator *******************************/ 2 | /** **/ 3 | /** ConDebug.c **/ 4 | /** **/ 5 | /** This file contains a console version of the built-in **/ 6 | /** debugger, using EMULib's Console.c. When -DCONDEBUG is **/ 7 | /** ommitted, ConDebug.c just includes the default command **/ 8 | /** line based debugger (Debug.c). **/ 9 | /** **/ 10 | /** Copyright (C) Marat Fayzullin 2005-2018 **/ 11 | /** You are not allowed to distribute this software **/ 12 | /** commercially. Please, notify me, if you make any **/ 13 | /** changes to this file. **/ 14 | /*************************************************************/ 15 | #ifdef DEBUG 16 | 17 | #ifndef CONDEBUG 18 | /** Normal DebugZ80() ****************************************/ 19 | /** When CONDEBUG #undefined, we use plain command line. **/ 20 | /*************************************************************/ 21 | #include "Debug.c" 22 | 23 | #else 24 | /** Console DebugZ80() ***************************************/ 25 | /** When CONDEBUG #defined, we use EMULib console. **/ 26 | /*************************************************************/ 27 | 28 | #include "Z80.h" 29 | #include "Console.h" 30 | #include 31 | 32 | #define DebugZ80 OriginalDebugZ80 33 | #include "Debug.c" 34 | #undef DebugZ80 35 | 36 | #ifdef SPECCY 37 | #include "Spectrum.h" 38 | #endif 39 | 40 | #define CLR_BACK PIXEL(255,255,255) 41 | #define CLR_TEXT PIXEL(0,0,0) 42 | #define CLR_DIALOG PIXEL(0,100,0) 43 | #define CLR_PC PIXEL(255,0,0) 44 | #define CLR_SP PIXEL(0,0,100) 45 | 46 | static byte ChrDump(byte C) 47 | { 48 | return((C>=32)&&(C<128)? C:'.'); 49 | } 50 | 51 | /** DebugZ80() ***********************************************/ 52 | /** This function should exist if DEBUG is #defined. When **/ 53 | /** Trace!=0, it is called after each command executed by **/ 54 | /** the CPU, and given the Z80 registers. **/ 55 | /*************************************************************/ 56 | byte DebugZ80(Z80 *R) 57 | { 58 | char S[1024]; 59 | word A,Addr,ABuf[20]; 60 | int J,I,K,X,Y,MemoryDump,DrawWindow,ExitNow; 61 | 62 | /* If we don't have enough screen estate... */ 63 | if((VideoW<32*8)||(VideoH<23*8)) 64 | { 65 | /* Show warning message */ 66 | CONMsg( 67 | -1,-1,-1,-1,PIXEL(255,255,255),PIXEL(255,0,0), 68 | "Error","Screen is\0too small!\0\0" 69 | ); 70 | /* Continue emulation */ 71 | R->Trace=0; 72 | return(1); 73 | } 74 | 75 | #ifdef SPECCY 76 | /* Show currently refreshed scanline on Speccy */ 77 | RefreshScreen(); 78 | #endif 79 | 80 | X = ((VideoW>>3)-32)>>1; 81 | Y = ((VideoH>>3)-23)>>1; 82 | Addr = R->PC.W; 83 | A = ~Addr; 84 | K = 0; 85 | 86 | for(DrawWindow=1,MemoryDump=ExitNow=0;!ExitNow&&VideoImg;) 87 | { 88 | if(DrawWindow) 89 | { 90 | CONWindow(X,Y,32,23,CLR_TEXT,CLR_BACK,"Z80 Debugger"); 91 | 92 | sprintf(S,"PC %04X",R->PC.W); 93 | CONSetColor(CLR_BACK,CLR_PC); 94 | CONPrint(X+24,Y+18,S); 95 | sprintf(S,"SP %04X",R->SP.W); 96 | CONSetColor(CLR_BACK,CLR_SP); 97 | CONPrint(X+24,Y+19,S); 98 | 99 | CONSetColor(CLR_TEXT,CLR_BACK); 100 | sprintf(S, 101 | " %c%c%c%c%c%c\n\n" 102 | "AF %04X\nBC %04X\nDE %04X\nHL %04X\nIX %04X\nIY %04X\n\n" 103 | "AF'%04X\nBC'%04X\nDE'%04X\nHL'%04X\n\n" 104 | "IR %02X%02X", 105 | R->AF.B.l&0x80? 'S':'.',R->AF.B.l&0x40? 'Z':'.',R->AF.B.l&0x10? 'H':'.', 106 | R->AF.B.l&0x04? 'P':'.',R->AF.B.l&0x02? 'N':'.',R->AF.B.l&0x01? 'C':'.', 107 | R->AF.W,R->BC.W,R->DE.W,R->HL.W, 108 | R->IX.W,R->IY.W, 109 | R->AF1.W,R->BC1.W,R->DE1.W,R->HL1.W, 110 | R->I,R->R 111 | ); 112 | CONPrint(X+24,Y+2,S); 113 | sprintf(S, 114 | "%s %s", 115 | R->IFF&0x04? "IM2":R->IFF&0x02? "IM1":"IM0", 116 | R->IFF&0x01? "EI":"DI" 117 | ); 118 | CONPrint(X+25,Y+21,S); 119 | DrawWindow=0; 120 | A=~Addr; 121 | } 122 | 123 | /* If top address has changed... */ 124 | if(A!=Addr) 125 | { 126 | /* Clear display */ 127 | CONBox((X+1)<<3,(Y+2)<<3,23*8,20*8,CLR_BACK); 128 | 129 | if(MemoryDump) 130 | { 131 | /* Draw memory dump */ 132 | for(J=0,A=Addr;J<20;J++,A+=4) 133 | { 134 | if(A==R->PC.W) CONSetColor(CLR_BACK,CLR_PC); 135 | else if(A==R->SP.W) CONSetColor(CLR_BACK,CLR_SP); 136 | else CONSetColor(CLR_TEXT,CLR_BACK); 137 | sprintf(S,"%04X%c",A,A==R->PC.W? CON_MORE:A==R->SP.W? CON_LESS:':'); 138 | CONPrint(X+1,Y+J+2,S); 139 | 140 | CONSetColor(CLR_TEXT,CLR_BACK); 141 | sprintf(S, 142 | "%02X %02X %02X %02X %c%c%c%c", 143 | RdZ80(A),RdZ80(A+1),RdZ80(A+2),RdZ80(A+3), 144 | ChrDump(RdZ80(A)),ChrDump(RdZ80(A+1)), 145 | ChrDump(RdZ80(A+2)),ChrDump(RdZ80(A+3)) 146 | ); 147 | CONPrint(X+7,Y+J+2,S); 148 | } 149 | } 150 | else 151 | { 152 | /* Draw listing */ 153 | for(J=0,A=Addr;J<20;J++) 154 | { 155 | if(A==R->PC.W) CONSetColor(CLR_BACK,CLR_PC); 156 | else if(A==R->SP.W) CONSetColor(CLR_BACK,CLR_SP); 157 | else CONSetColor(CLR_TEXT,CLR_BACK); 158 | sprintf(S,"%04X%c",A,A==R->PC.W? CON_MORE:A==R->SP.W? CON_LESS:':'); 159 | CONPrint(X+1,Y+J+2,S); 160 | 161 | ABuf[J]=A; 162 | A+=DAsm(S,A); 163 | 164 | CONSetColor(CLR_TEXT,CLR_BACK); 165 | CONPrintN(X+7,Y+J+2,S,23); 166 | } 167 | } 168 | 169 | /* Display redrawn */ 170 | A=Addr; 171 | } 172 | 173 | /* Draw pointer */ 174 | CONChar(X+6,Y+K+2,CON_ARROW); 175 | 176 | /* Show screen buffer */ 177 | ShowVideo(); 178 | 179 | /* Get key code */ 180 | GetKey(); 181 | I=WaitKey(); 182 | 183 | /* Clear pointer */ 184 | CONChar(X+6,Y+K+2,' '); 185 | 186 | /* Get and process key code */ 187 | switch(I) 188 | { 189 | case 'H': 190 | CONMsg( 191 | -1,-1,-1,-1, 192 | CLR_BACK,CLR_DIALOG, 193 | "Debugger Help", 194 | "ENTER - Execute next opcode\0" 195 | " UP - Previous opcode\0" 196 | " DOWN - Next opcode\0" 197 | " LEFT - Page up\0" 198 | "RIGHT - Page down\0" 199 | " H - This help page\0" 200 | " G - Go to address\0" 201 | " D - Disassembler view\0" 202 | " M - Memory dump view\0" 203 | " S - Show stack\0" 204 | " J - Jump to cursor\0" 205 | " R - Run to cursor\0" 206 | " C - Continue execution\0" 207 | " Q - Quit emulator\0" 208 | ); 209 | DrawWindow=1; 210 | break; 211 | case CON_UP: 212 | if(K) --K; 213 | else 214 | if(MemoryDump) Addr-=4; 215 | else for(--Addr;Addr+DAsm(S,Addr)>A;--Addr); 216 | break; 217 | case CON_DOWN: 218 | if(K<19) ++K; 219 | else 220 | if(MemoryDump) Addr+=4; 221 | else Addr+=DAsm(S,Addr); 222 | break; 223 | case CON_LEFT: 224 | if(MemoryDump) 225 | Addr-=4*20; 226 | else 227 | { 228 | for(I=20,Addr=~A;(Addr>A)||((A^Addr)&~Addr&0x8000);++I) 229 | for(J=0,Addr=A-I;J<20;++J) Addr+=DAsm(S,Addr); 230 | Addr=A-I+1; 231 | } 232 | break; 233 | case CON_RIGHT: 234 | if(MemoryDump) 235 | Addr+=4*20; 236 | else 237 | for(J=0;J<20;++J) Addr+=DAsm(S,Addr); 238 | break; 239 | case CON_OK: 240 | ExitNow=1; 241 | break; 242 | case '\0': 243 | case 'Q': 244 | return(0); 245 | case CON_EXIT: 246 | case 'C': 247 | R->Trap=0xFFFF; 248 | R->Trace=0; 249 | ExitNow=1; 250 | break; 251 | case 'R': 252 | R->Trap=ABuf[K]; 253 | R->Trace=0; 254 | ExitNow=1; 255 | break; 256 | case 'M': 257 | MemoryDump=1; 258 | A=~Addr; 259 | break; 260 | case 'S': 261 | MemoryDump=1; 262 | Addr=R->SP.W; 263 | K=0; 264 | A=~Addr; 265 | break; 266 | case 'D': 267 | MemoryDump=0; 268 | A=~Addr; 269 | break; 270 | case 'G': 271 | if(CONInput(-1,-1,CLR_BACK,CLR_DIALOG,"Go to Address:",S,5|CON_HEX)) 272 | { Addr=strtoul(S,0,16);K=0; } 273 | DrawWindow=1; 274 | break; 275 | case 'J': 276 | R->PC.W=ABuf[K]; 277 | A=~Addr; 278 | break; 279 | } 280 | } 281 | 282 | /* Continue emulation */ 283 | return(1); 284 | } 285 | 286 | #endif /* CONDEBUG */ 287 | #endif /* DEBUG */ 288 | -------------------------------------------------------------------------------- /src/Z80/Z80.h: -------------------------------------------------------------------------------- 1 | /** Z80: portable Z80 emulator *******************************/ 2 | /** **/ 3 | /** Z80.h **/ 4 | /** **/ 5 | /** This file contains declarations relevant to emulation **/ 6 | /** of Z80 CPU. **/ 7 | /** **/ 8 | /** Copyright (C) Marat Fayzullin 1994-2018 **/ 9 | /** You are not allowed to distribute this software **/ 10 | /** commercially. Please, notify me, if you make any **/ 11 | /** changes to this file. **/ 12 | /*************************************************************/ 13 | #ifndef Z80_H 14 | #define Z80_H 15 | 16 | #ifdef __cplusplus 17 | extern "C" { 18 | #endif 19 | 20 | /* Compilation options: */ 21 | /* #define DEBUG */ /* Compile debugging version */ 22 | /* #define LSB_FIRST */ /* Compile for low-endian CPU */ 23 | /* #define MSB_FIRST */ /* Compile for hi-endian CPU */ 24 | 25 | /* LoopZ80() may return: */ 26 | #define INT_RST00 0x00C7 /* RST 00h */ 27 | #define INT_RST08 0x00CF /* RST 08h */ 28 | #define INT_RST10 0x00D7 /* RST 10h */ 29 | #define INT_RST18 0x00DF /* RST 18h */ 30 | #define INT_RST20 0x00E7 /* RST 20h */ 31 | #define INT_RST28 0x00EF /* RST 28h */ 32 | #define INT_RST30 0x00F7 /* RST 30h */ 33 | #define INT_RST38 0x00FF /* RST 38h */ 34 | #define INT_IRQ INT_RST38 /* Default IRQ opcode is FFh */ 35 | #define INT_NMI 0xFFFD /* Non-maskable interrupt */ 36 | #define INT_NONE 0xFFFF /* No interrupt required */ 37 | #define INT_QUIT 0xFFFE /* Exit the emulation */ 38 | 39 | /* Bits in Z80 F register: */ 40 | #define S_FLAG 0x80 /* 1: Result negative */ 41 | #define Z_FLAG 0x40 /* 1: Result is zero */ 42 | #define H_FLAG 0x10 /* 1: Halfcarry/Halfborrow */ 43 | #define P_FLAG 0x04 /* 1: Result is even */ 44 | #define V_FLAG 0x04 /* 1: Overflow occured */ 45 | #define N_FLAG 0x02 /* 1: Subtraction occured */ 46 | #define C_FLAG 0x01 /* 1: Carry/Borrow occured */ 47 | 48 | /* Bits in IFF flip-flops: */ 49 | #define IFF_1 0x01 /* IFF1 flip-flop */ 50 | #define IFF_IM1 0x02 /* 1: IM1 mode */ 51 | #define IFF_IM2 0x04 /* 1: IM2 mode */ 52 | #define IFF_2 0x08 /* IFF2 flip-flop */ 53 | #define IFF_EI 0x20 /* 1: EI pending */ 54 | #define IFF_HALT 0x80 /* 1: CPU HALTed */ 55 | 56 | /** Simple Datatypes *****************************************/ 57 | /** NOTICE: sizeof(byte)=1 and sizeof(word)=2 **/ 58 | /*************************************************************/ 59 | #ifndef BYTE_TYPE_DEFINED 60 | #define BYTE_TYPE_DEFINED 61 | typedef unsigned char byte; 62 | #endif 63 | #ifndef WORD_TYPE_DEFINED 64 | #define WORD_TYPE_DEFINED 65 | typedef unsigned short word; 66 | #endif 67 | typedef signed char offset; 68 | 69 | /** Structured Datatypes *************************************/ 70 | /** NOTICE: #define LSB_FIRST for machines where least **/ 71 | /** signifcant byte goes first. **/ 72 | /*************************************************************/ 73 | typedef union 74 | { 75 | #ifdef LSB_FIRST 76 | struct { byte l,h; } B; 77 | #else 78 | struct { byte h,l; } B; 79 | #endif 80 | word W; 81 | } pair; 82 | 83 | typedef struct 84 | { 85 | pair AF,BC,DE,HL,IX,IY,PC,SP; /* Main registers */ 86 | pair AF1,BC1,DE1,HL1; /* Shadow registers */ 87 | byte IFF,I; /* Interrupt registers */ 88 | byte R; /* Refresh register */ 89 | 90 | int IPeriod,ICount; /* Set IPeriod to number of CPU cycles */ 91 | /* between calls to LoopZ80() */ 92 | int IBackup; /* Private, don't touch */ 93 | word IRequest; /* Set to address of pending IRQ */ 94 | byte IAutoReset; /* Set to 1 to autom. reset IRequest */ 95 | byte TrapBadOps; /* Set to 1 to warn of illegal opcodes */ 96 | word Trap; /* Set Trap to address to trace from */ 97 | byte Trace; /* Set Trace=1 to start tracing */ 98 | unsigned int User; /* Arbitrary user data (ID,RAM*,etc.) */ 99 | } Z80; 100 | 101 | /** ResetZ80() ***********************************************/ 102 | /** This function can be used to reset the registers before **/ 103 | /** starting execution with RunZ80(). It sets registers to **/ 104 | /** their initial values. **/ 105 | /*************************************************************/ 106 | void ResetZ80(register Z80 *R); 107 | 108 | /** ExecZ80() ************************************************/ 109 | /** This function will execute given number of Z80 cycles. **/ 110 | /** It will then return the number of cycles left, possibly **/ 111 | /** negative, and current register values in R. **/ 112 | /*************************************************************/ 113 | #ifdef EXECZ80 114 | int ExecZ80(register Z80 *R,register int RunCycles); 115 | #endif 116 | 117 | /** IntZ80() *************************************************/ 118 | /** This function will generate interrupt of given vector. **/ 119 | /*************************************************************/ 120 | void IntZ80(register Z80 *R,register word Vector); 121 | 122 | /** RunZ80() *************************************************/ 123 | /** This function will run Z80 code until an LoopZ80() call **/ 124 | /** returns INT_QUIT. It will return the PC at which **/ 125 | /** emulation stopped, and current register values in R. **/ 126 | /*************************************************************/ 127 | #ifndef EXECZ80 128 | word RunZ80(register Z80 *R); 129 | #endif 130 | 131 | /** RdZ80()/WrZ80() ******************************************/ 132 | /** These functions are called when access to RAM occurs. **/ 133 | /** They allow to control memory access. **/ 134 | /************************************ TO BE WRITTEN BY USER **/ 135 | void WrZ80(register word Addr,register byte Value); 136 | byte RdZ80(register word Addr); 137 | 138 | /** InZ80()/OutZ80() *****************************************/ 139 | /** Z80 emulation calls these functions to read/write from **/ 140 | /** I/O ports. There can be 65536 I/O ports, but only first **/ 141 | /** 256 are usually used. **/ 142 | /************************************ TO BE WRITTEN BY USER **/ 143 | void OutZ80(register word Port,register byte Value); 144 | byte InZ80(register word Port); 145 | 146 | /** PatchZ80() ***********************************************/ 147 | /** Z80 emulation calls this function when it encounters a **/ 148 | /** special patch command (ED FE) provided for user needs. **/ 149 | /** For example, it can be called to emulate BIOS calls, **/ 150 | /** such as disk and tape access. Replace it with an empty **/ 151 | /** macro for no patching. **/ 152 | /************************************ TO BE WRITTEN BY USER **/ 153 | void PatchZ80(register Z80 *R); 154 | 155 | /** DebugZ80() ***********************************************/ 156 | /** This function should exist if DEBUG is #defined. When **/ 157 | /** Trace!=0, it is called after each command executed by **/ 158 | /** the CPU, and given the Z80 registers. Emulation exits **/ 159 | /** if DebugZ80() returns 0. **/ 160 | /*************************************************************/ 161 | #ifdef DEBUG 162 | byte DebugZ80(register Z80 *R); 163 | #endif 164 | 165 | /** LoopZ80() ************************************************/ 166 | /** Z80 emulation calls this function periodically to check **/ 167 | /** if the system hardware requires any interrupts. This **/ 168 | /** function must return an address of the interrupt vector **/ 169 | /** (0x0038, 0x0066, etc.) or INT_NONE for no interrupt. **/ 170 | /** Return INT_QUIT to exit the emulation loop. **/ 171 | /************************************ TO BE WRITTEN BY USER **/ 172 | word LoopZ80(register Z80 *R); 173 | 174 | /** JumpZ80() ************************************************/ 175 | /** Z80 emulation calls this function when it executes a **/ 176 | /** JP, JR, CALL, RST, or RET. You can use JumpZ80() to **/ 177 | /** trap these opcodes and switch memory layout. **/ 178 | /************************************ TO BE WRITTEN BY USER **/ 179 | #ifndef JUMPZ80 180 | #define JumpZ80(PC) 181 | #else 182 | void JumpZ80(word PC); 183 | #endif 184 | 185 | #ifdef __cplusplus 186 | } 187 | #endif 188 | #endif /* Z80_H */ 189 | -------------------------------------------------------------------------------- /src/wii/wii_app_common.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_APP_COMMON_H 30 | #define WII_APP_COMMON_H 31 | 32 | #include "wii_main.h" 33 | 34 | #define WII_FILES_DIR "/wiicolem/" 35 | #define WII_ROMS_DIR WII_FILES_DIR "roms/" 36 | #define WII_SAVES_DIR WII_FILES_DIR "saves/" 37 | #define WII_STATES_DIR WII_FILES_DIR "states/" 38 | #define WII_OVERLAYS_DIR WII_FILES_DIR "overlays/" 39 | #define WII_CONFIG_FILE WII_FILES_DIR "wiicolem.conf" 40 | 41 | #define WII_BASE_APP_DIR "sd:/apps/wiicolem/" 42 | 43 | #define WII_SAVE_GAME_EXT "sta" 44 | #define WII_STATE_GAME_EXT "sav" 45 | #define WII_COLECO_ROM WII_FILES_DIR "COLECO.ROM" 46 | 47 | /** 48 | * The different types of nodes in the menu 49 | */ 50 | enum NODETYPE { 51 | NODETYPE_ROOT = 0, 52 | NODETYPE_SPACER, 53 | NODETYPE_LOAD_ROM, 54 | NODETYPE_ROOT_DRIVE, 55 | NODETYPE_UPDIR, 56 | NODETYPE_DIR, 57 | NODETYPE_ROM, 58 | NODETYPE_EXIT, 59 | NODETYPE_RESUME, 60 | NODETYPE_ADVANCED, 61 | NODETYPE_DEBUG_MODE, 62 | NODETYPE_TOP_MENU_EXIT, 63 | NODETYPE_RESET, 64 | NODETYPE_SAVE_STATE, 65 | NODETYPE_LOAD_STATE, 66 | NODETYPE_DELETE_STATE, 67 | NODETYPE_CARTRIDGE_SAVE_STATES_SPACER, 68 | NODETYPE_CARTRIDGE_SAVE_STATES, 69 | NODETYPE_CARTRIDGE_SAVE_STATES_SLOT, 70 | NODETYPE_VSYNC, 71 | NODETYPE_DISPLAY_SETTINGS, 72 | NODETYPE_CONTROLS_SETTINGS, 73 | NODETYPE_PALETTE, 74 | NODETYPE_SHOW_ALL_SPRITES, 75 | NODETYPE_CARTRIDGE_SETTINGS_CURRENT, 76 | NODETYPE_CARTRIDGE_SETTINGS_CURRENT_SPACER, 77 | NODETYPE_CARTRIDGE_SETTINGS_DEFAULT, 78 | NODETYPE_VIEW_AS_CONTROLLER, 79 | NODETYPE_BUTTON1, 80 | NODETYPE_BUTTON2, 81 | NODETYPE_BUTTON3, 82 | NODETYPE_BUTTON4, 83 | NODETYPE_BUTTON5, 84 | NODETYPE_BUTTON6, 85 | NODETYPE_BUTTON7, 86 | NODETYPE_BUTTON8, 87 | NODETYPE_SAVE_CARTRIDGE_SETTINGS, 88 | NODETYPE_DELETE_CARTRIDGE_SETTINGS, 89 | NODETYPE_CONTROLS_MODE, 90 | NODETYPE_WIIMOTE_HORIZONTAL, 91 | NODETYPE_CARTRIDGE_SETTINGS_CONTROLS, 92 | NODETYPE_CARTRIDGE_SETTINGS_ADVANCED, 93 | NODETYPE_OPCODE_MEMORY, 94 | NODETYPE_CART_SRAM, 95 | NODETYPE_REVERT_CARTRIDGE_SETTINGS, 96 | NODETYPE_SPINNER, 97 | NODETYPE_SENSITIVITY, 98 | NODETYPE_KEYPAD_PAUSE, 99 | NODETYPE_KEYPAD_PAUSE_CART, 100 | NODETYPE_KEYPAD_SIZE, 101 | NODETYPE_KEYPAD_SIZE_CART, 102 | NODETYPE_USE_OVERLAY, 103 | NODETYPE_USE_OVERLAY_CART, 104 | NODETYPE_CYCLE_ADJUST, 105 | NODETYPE_VOLUME, 106 | NODETYPE_MAX_FRAMES, 107 | NODETYPE_RESIZE_SCREEN, 108 | NODETYPE_MAX_FRAMES_CART, 109 | NODETYPE_WIIMOTE_MENU_ORIENT, 110 | NODETYPE_SUPER_GAME_MODULE, 111 | NODETYPE_EEPROM, 112 | NODETYPE_16_9_CORRECTION, 113 | NODETYPE_FULL_WIDESCREEN, 114 | NODETYPE_FILTER, 115 | NODETYPE_GX_VI_SCALER, 116 | NODETYPE_DOUBLE_STRIKE, 117 | NODETYPE_TRAP_FILTER 118 | }; 119 | 120 | #endif 121 | -------------------------------------------------------------------------------- /src/wii/wii_coleco.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_COLECO_H 30 | #define WII_COLECO_H 31 | 32 | #include "wii_main.h" 33 | #include "wii_coleco_db.h" 34 | #include "wii_resize_screen.h" 35 | 36 | #define TMS9918_WIDTH 280 37 | #define COLECO_WIDTH 272 38 | #define COLECO_HEIGHT 200 39 | 40 | // Default screen size 41 | // 256x192: Coleco 42 | // 272x200: Colem 43 | // 280x: TMS9981 (PAR 8:7) 44 | #define DEFAULT_SCREEN_X 732 45 | #define DEFAULT_SCREEN_Y 480 46 | 47 | // Wii width and height 48 | #define WII_WIDTH 640 49 | #define WII_HEIGHT 480 50 | #define WII_WIDTH_DIV2 320 51 | #define WII_HEIGHT_DIV2 240 52 | 53 | // ColecoVision button mappings 54 | #define WII_BUTTON_CV_SHOW_KEYPAD (WPAD_BUTTON_PLUS | WPAD_CLASSIC_BUTTON_PLUS) 55 | #define GC_BUTTON_CV_SHOW_KEYPAD (PAD_BUTTON_START) 56 | #define WII_BUTTON_CV_RIGHT (WPAD_BUTTON_DOWN | WPAD_CLASSIC_BUTTON_RIGHT) 57 | #define GC_BUTTON_CV_RIGHT (PAD_BUTTON_RIGHT) 58 | #define WII_BUTTON_CV_UP (WPAD_BUTTON_RIGHT) 59 | #define GC_BUTTON_CV_UP (PAD_BUTTON_UP) 60 | #define WII_CLASSIC_CV_UP (WPAD_CLASSIC_BUTTON_UP) 61 | #define WII_BUTTON_CV_DOWN (WPAD_BUTTON_LEFT | WPAD_CLASSIC_BUTTON_DOWN) 62 | #define GC_BUTTON_CV_DOWN (PAD_BUTTON_DOWN) 63 | #define WII_BUTTON_CV_LEFT (WPAD_BUTTON_UP) 64 | #define WII_CLASSIC_CV_LEFT (WPAD_CLASSIC_BUTTON_LEFT) 65 | #define GC_BUTTON_CV_LEFT (PAD_BUTTON_LEFT) 66 | 67 | #define WII_NUNCHECK_CV_1 (WPAD_NUNCHUK_BUTTON_C) 68 | #define WII_BUTTON_CV_1 (WPAD_BUTTON_2) 69 | #define GC_BUTTON_CV_1 (PAD_BUTTON_A) 70 | #define WII_CLASSIC_CV_1 (WPAD_CLASSIC_BUTTON_A) 71 | #define WII_NUNCHECK_CV_2 (WPAD_NUNCHUK_BUTTON_Z) 72 | #define WII_BUTTON_CV_2 (WPAD_BUTTON_1) 73 | #define GC_BUTTON_CV_2 (PAD_BUTTON_B) 74 | #define WII_CLASSIC_CV_2 (WPAD_CLASSIC_BUTTON_B) 75 | #define WII_BUTTON_CV_3 (WPAD_BUTTON_A) 76 | #define GC_BUTTON_CV_3 (PAD_BUTTON_X) 77 | #define WII_CLASSIC_CV_3 (WPAD_CLASSIC_BUTTON_X) 78 | #define WII_BUTTON_CV_4 (WPAD_BUTTON_B) 79 | #define GC_BUTTON_CV_4 (PAD_BUTTON_Y) 80 | #define WII_CLASSIC_CV_4 (WPAD_CLASSIC_BUTTON_Y) 81 | #define GC_BUTTON_CV_5 (PAD_TRIGGER_R) 82 | #define WII_CLASSIC_CV_5 (WPAD_CLASSIC_BUTTON_FULL_R) 83 | #define GC_BUTTON_CV_6 (PAD_TRIGGER_L) 84 | #define WII_CLASSIC_CV_6 (WPAD_CLASSIC_BUTTON_FULL_L) 85 | #define WII_CLASSIC_CV_7 (WPAD_CLASSIC_BUTTON_ZR) 86 | #define WII_CLASSIC_CV_8 (WPAD_CLASSIC_BUTTON_ZL) 87 | 88 | /** The last ColecoVision cartridge hash */ 89 | extern char wii_cartridge_hash[33]; 90 | /** The current ColecoVision Mode */ 91 | extern int wii_coleco_mode; 92 | /** The ColecoVision database entry for current game */ 93 | extern ColecoDBEntry wii_coleco_db_entry; 94 | /** The coleco controller view mode */ 95 | extern int wii_coleco_controller_view_mode; 96 | /** Whether to display debug info (FPS, etc.) */ 97 | extern short wii_debug; 98 | /** Keypad pause */ 99 | extern BOOL wii_keypad_pause; 100 | /** Keypad size */ 101 | extern u8 wii_keypad_size; 102 | /** Overlay mode */ 103 | extern BOOL wii_use_overlay; 104 | /** Super Game Module enabled */ 105 | extern BOOL wii_super_game_module; 106 | /** Volume */ 107 | extern u8 wii_volume; 108 | /** Maximum frame rate */ 109 | extern u8 wii_max_frames; 110 | /** The screen X size */ 111 | extern int wii_screen_x; 112 | /** The screen Y size */ 113 | extern int wii_screen_y; 114 | /** Whether to filter the display */ 115 | extern BOOL wii_filter; 116 | /** Whether to use the GX/VI scaler */ 117 | extern BOOL wii_gx_vi_scaler; 118 | 119 | /** 120 | * Returns the current roms directory 121 | * 122 | * @return The current roms directory 123 | */ 124 | char* wii_get_roms_dir(); 125 | 126 | /** 127 | * Sets the current roms directory 128 | * 129 | * @param newDir The new roms directory 130 | */ 131 | void wii_set_roms_dir(const char* newDir); 132 | 133 | /** 134 | * Returns the saves directory 135 | * 136 | * @return The saves directory 137 | */ 138 | char* wii_get_saves_dir(); 139 | 140 | /** 141 | * Returns the states directory 142 | * 143 | * @return The states directory 144 | */ 145 | char* wii_get_states_dir(); 146 | 147 | /** 148 | * Returns the overlays directory 149 | * 150 | * @return The overlays directory 151 | */ 152 | char* wii_get_overlays_dir(); 153 | 154 | /** 155 | * Checks and returns the state of the specified joystick 156 | * 157 | * @param joyIndex The index of the joystick to check 158 | * @return The current state of the specified joystick 159 | */ 160 | u32 wii_coleco_poll_joystick(int joyIndex); 161 | 162 | /** 163 | * Updates whether the Wii is in widescreen mode 164 | */ 165 | void wii_update_widescreen(); 166 | 167 | /** 168 | * Sets the video mode for the Wii 169 | * 170 | * @param allowVi Whether to allow the GX+VI mode 171 | */ 172 | void wii_set_video_mode(BOOL allowVi); 173 | 174 | /** 175 | * Returns the current size to use for the screen 176 | * 177 | * @param inX Input x value 178 | * @param inY Input y value 179 | * @param x (out) Output x value 180 | * @param y (out) Output y value 181 | */ 182 | void wii_get_screen_size(int inX, int inY, int* x, int* y); 183 | 184 | /** 185 | * Returns the default screen sizes 186 | * 187 | * @param sizes (out) The array of screen sizes 188 | * @param size_count (out) The count of screen sizes 189 | */ 190 | void wii_get_default_screen_sizes(const screen_size** sizes, int* size_count); 191 | 192 | #endif 193 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_config.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #include 30 | 31 | #include "wii_util.h" 32 | #include "wii_coleco.h" 33 | #include "wii_config.h" 34 | 35 | #include "networkop.h" 36 | 37 | /** 38 | * Handles reading a particular configuration value 39 | * 40 | * @param name The name of the config value 41 | * @param value The config value 42 | */ 43 | void wii_config_handle_read_value(char* name, char* value) { 44 | if (strcmp(name, "debug") == 0) { 45 | wii_debug = Util_sscandec(value); 46 | } else if (strcmp(name, "top_menu_exit") == 0) { 47 | wii_top_menu_exit = Util_sscandec(value); 48 | #ifdef ENABLE_VSYNC 49 | } else if (strcmp(name, "vsync") == 0) { 50 | wii_vsync = Util_sscandec(value); 51 | #endif 52 | } else if (strcmp(name, "col_mode") == 0) { 53 | wii_coleco_mode = Util_sscandec(value); 54 | } else if (strcmp(name, "controller_view_mode") == 0) { 55 | wii_coleco_controller_view_mode = Util_sscandec(value); 56 | } else if (strcmp(name, "keypad_pause") == 0) { 57 | wii_keypad_pause = Util_sscandec(value); 58 | } else if (strcmp(name, "keypad_size") == 0) { 59 | wii_keypad_size = Util_sscandec(value); 60 | } else if (strcmp(name, "use_overlay") == 0) { 61 | wii_use_overlay = Util_sscandec(value); 62 | } else if (strcmp(name, "volume") == 0) { 63 | wii_volume = Util_sscandec(value); 64 | } else if (strcmp(name, "max_frames") == 0) { 65 | wii_max_frames = Util_sscandec(value); 66 | } else if (strcmp(name, "screen_size_x") == 0) { 67 | wii_screen_x = Util_sscandec(value); 68 | } else if (strcmp(name, "screen_size_y") == 0) { 69 | wii_screen_y = Util_sscandec(value); 70 | } else if (strcmp(name, "sel_offset") == 0) { 71 | wii_menu_sel_offset = Util_sscandec(value); 72 | } else if (strcmp(name, "sel_color") == 0) { 73 | Util_hextorgba(value, &wii_menu_sel_color); 74 | } else if (strcmp(name, "mote_menu_vertical") == 0) { 75 | wii_mote_menu_vertical = Util_sscandec(value); 76 | } else if (strcmp(name, "super_game_module") == 0) { 77 | wii_super_game_module = Util_sscandec(value); 78 | } else if (strcmp(name, "16_9_correct") == 0) { 79 | wii_16_9_correction = Util_sscandec(value); 80 | } else if (strcmp(name, "full_widescreen") == 0) { 81 | wii_full_widescreen = Util_sscandec(value); 82 | } else if (strcmp(name, "video_filter") == 0) { 83 | wii_filter = Util_sscandec(value); 84 | } else if (strcmp(name, "vi_gx_scaler") == 0) { 85 | wii_gx_vi_scaler = Util_sscandec(value); 86 | } else if (strcmp(name, "double_strike") == 0) { 87 | wii_double_strike_mode = Util_sscandec(value); 88 | } else if (strcmp(name, "roms_dir") == 0) { 89 | wii_set_roms_dir(value); 90 | #ifdef ENABLE_SMB 91 | } else if (strcmp(name, "share_ip") == 0) { 92 | setSmbAddress(value); 93 | } else if (strcmp(name, "share_name") == 0) { 94 | setSmbShare(value); 95 | } else if (strcmp(name, "share_user") == 0) { 96 | setSmbUser(value); 97 | } else if (strcmp(name, "share_pass") == 0) { 98 | setSmbPassword(value); 99 | #endif 100 | } else if (strcmp(name, "usb_keepalive") == 0) { 101 | wii_usb_keepalive = Util_sscandec(value); 102 | } else if (strcmp(name, "trap_filter") == 0) { 103 | wii_trap_filter = Util_sscandec(value); 104 | } 105 | } 106 | 107 | /** 108 | * Handles the writing of the configuration file 109 | * 110 | * @param fp The pointer to the file to write to 111 | */ 112 | void wii_config_handle_write_config(FILE* fp) { 113 | fprintf(fp, "debug=%d\n", wii_debug); 114 | fprintf(fp, "top_menu_exit=%d\n", wii_top_menu_exit); 115 | #ifdef ENABLE_VSYNC 116 | fprintf(fp, "vsync=%d\n", wii_vsync); 117 | #endif 118 | fprintf(fp, "col_mode=%d\n", wii_coleco_mode); 119 | fprintf(fp, "controller_view_mode=%d\n", wii_coleco_controller_view_mode); 120 | fprintf(fp, "keypad_pause=%d\n", wii_keypad_pause); 121 | fprintf(fp, "keypad_size=%d\n", wii_keypad_size); 122 | fprintf(fp, "use_overlay=%d\n", wii_use_overlay); 123 | fprintf(fp, "volume=%d\n", wii_volume); 124 | fprintf(fp, "max_frames=%d\n", wii_max_frames); 125 | fprintf(fp, "screen_size_x=%d\n", wii_screen_x); 126 | fprintf(fp, "screen_size_y=%d\n", wii_screen_y); 127 | fprintf(fp, "sel_offset=%d\n", wii_menu_sel_offset); 128 | fprintf(fp, "mote_menu_vertical=%d\n", wii_mote_menu_vertical); 129 | fprintf(fp, "super_game_module=%d\n", wii_super_game_module); 130 | fprintf(fp, "16_9_correct=%d\n", wii_16_9_correction); 131 | fprintf(fp, "double_strike=%d\n", wii_double_strike_mode); 132 | fprintf(fp, "full_widescreen=%d\n", wii_full_widescreen); 133 | fprintf(fp, "video_filter=%d\n", wii_filter); 134 | fprintf(fp, "vi_gx_scaler=%d\n", wii_gx_vi_scaler); 135 | fprintf(fp, "roms_dir=%s\n", wii_get_roms_dir()); 136 | #ifdef ENABLE_SMB 137 | fprintf(fp, "share_ip=%s\n", getSmbAddress()); 138 | fprintf(fp, "share_name=%s\n", getSmbShare()); 139 | fprintf(fp, "share_user=%s\n", getSmbUser()); 140 | fprintf(fp, "share_pass=%s\n", getSmbPassword()); 141 | #endif 142 | fprintf(fp, "usb_keepalive=%d\n", wii_usb_keepalive); 143 | fprintf(fp, "trap_filter=%d\n", wii_trap_filter); 144 | 145 | char hex[64] = ""; 146 | Util_rgbatohex(&wii_menu_sel_color, hex); 147 | fprintf(fp, "sel_color=%s\n", hex); 148 | } 149 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_emulation.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_COLECO_EMULATION_H 30 | #define WII_COLECO_EMULATION_H 31 | 32 | #include 33 | 34 | /** 35 | * Starts the emulator for the specified rom file. 36 | * 37 | * @param romfile The rom file to run in the emulator 38 | * @param savefile The name of the save file to load. 39 | * If this value is NULL, no save is explicitly loaded. 40 | * @param reset Whether we are resetting the current game 41 | * @param resume Whether we are resuming the current game 42 | * @return Whether the emulation started successfully 43 | */ 44 | BOOL wii_start_emulation(char* romfile, 45 | const char* savefile, 46 | BOOL reset, 47 | BOOL resume); 48 | 49 | /** 50 | * Resumes emulation of the current game 51 | * 52 | * @return Whether we were able to resume emulation 53 | */ 54 | BOOL wii_resume_emulation(); 55 | 56 | /** 57 | * Resets the current game 58 | * 59 | * @return Whether we were able to reset emulation 60 | */ 61 | BOOL wii_reset_emulation(); 62 | 63 | #endif 64 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_keypad.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_COLECO_KEYPAD_H 30 | #define WII_COLECO_KEYPAD_H 31 | 32 | #include 33 | 34 | /** 35 | * Renders the keypads 36 | */ 37 | void wii_keypad_render(); 38 | 39 | /** 40 | * Polls the joysticks and returns state information regarding keypad 41 | * selection. 42 | * 43 | * @return State indicating keypad selection 44 | */ 45 | u32 wii_keypad_poll_joysticks(); 46 | 47 | /** 48 | * Check whether the specified keypad is visble (0-based) 49 | * 50 | * @param keypadIndex The keypad to check 51 | * @return Whether the specified keypad is visible 52 | */ 53 | BOOL wii_keypad_is_visible(int keypadIndex); 54 | 55 | /** 56 | * Hides the specified keypad 57 | * 58 | * @param keypadIndex The keypad to hide 59 | */ 60 | void wii_keypad_hide(int keypadIndex); 61 | 62 | /** 63 | * Hides both of the keypads 64 | */ 65 | void wii_keypad_hide_both(); 66 | 67 | /** 68 | * Returns whether the value specified contains a key press for the given 69 | * keypad. 70 | * 71 | * @return Whether the value specified contains a key press for the 72 | * given keypad. 73 | */ 74 | BOOL wii_keypad_is_pressed(int keypadIndex, u32 value); 75 | 76 | /** 77 | * Whether to pause the keypad if it is displayed 78 | * 79 | * @param entry The database entry 80 | * @return Whether to pause the keypad if it is displayed 81 | */ 82 | BOOL wii_keypad_is_pause_enabled(ColecoDBEntry* entry); 83 | 84 | /** 85 | * Resets the keypads 86 | */ 87 | void wii_keypad_reset(); 88 | 89 | /** 90 | * Frees the keypad resources 91 | */ 92 | void wii_keypad_free_resources(); 93 | 94 | /** 95 | * Whether to dim the screen when the keypads are displayed 96 | * 97 | * @param dim Whether to dim the screen when the keypads are displayed 98 | */ 99 | void wii_keypad_set_dim_screen(BOOL dim); 100 | 101 | #endif 102 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_menu.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_COLECO_MENU_H 30 | #define WII_COLECO_MENU_H 31 | 32 | /** 33 | * Initializes the ColecoVision menu 34 | */ 35 | void wii_coleco_menu_init(); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_sdl.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #include "wii_sdl.h" 30 | #include "wii_coleco.h" 31 | 32 | /** 33 | * Initializes the SDL library 34 | */ 35 | int wii_sdl_handle_init() { 36 | if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) < 0) { 37 | return 0; 38 | } 39 | 40 | if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0) { 41 | return 0; 42 | } 43 | 44 | back_surface = SDL_SetVideoMode(WII_WIDTH, WII_HEIGHT, 8, 45 | SDL_DOUBLEBUF | SDL_HWSURFACE); 46 | 47 | if (!back_surface) { 48 | return 0; 49 | } 50 | 51 | blit_surface = SDL_CreateRGBSurface( 52 | SDL_SWSURFACE, COLECO_WIDTH, COLECO_HEIGHT, 53 | back_surface->format->BitsPerPixel, back_surface->format->Rmask, 54 | back_surface->format->Gmask, back_surface->format->Bmask, 0); 55 | 56 | return 1; 57 | } 58 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_snapshot.cpp: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #include 30 | #include 31 | #include 32 | 33 | #include "Coleco.h" 34 | 35 | #include "wii_app_common.h" 36 | #include "wii_app.h" 37 | #include "wii_snapshot.h" 38 | #include "wii_util.h" 39 | #include "wii_coleco.h" 40 | #include "wii_coleco_emulation.h" 41 | #include "wii_coleco_snapshot.h" 42 | 43 | #define MAX_SNAPSHOTS 10 44 | 45 | /** The current snapshot index */ 46 | static int ss_index = 0; 47 | /** Whether the snapshot associated with the current index exists */ 48 | static int ss_exists = -1; 49 | /** The index of the latest snapshot */ 50 | static int ss_latest = -1; 51 | /** The save name */ 52 | static char savename[WII_MAX_PATH] = ""; 53 | /** The file name */ 54 | static char filename[WII_MAX_PATH] = ""; 55 | 56 | /** 57 | * Returns the name of the snapshot associated with the specified romfile and 58 | * the snapshot index 59 | * 60 | * @param romfile The rom file 61 | * @param index The snapshot index 62 | * @param buffer The output buffer to receive the name of the snapshot file 63 | * (length must be WII_MAX_PATH) 64 | */ 65 | static void get_snapshot_name(const char* romfile, int index, char* buffer) { 66 | filename[0] = '\0'; 67 | Util_splitpath(romfile, NULL, filename); 68 | snprintf(buffer, WII_MAX_PATH, "%s%s.%d.%s", wii_get_saves_dir(), filename, 69 | index, WII_SAVE_GAME_EXT); 70 | } 71 | 72 | /** 73 | * Refreshes state of snapshot (does it exist, etc.) 74 | */ 75 | void wii_snapshot_refresh() { 76 | ss_exists = -1; 77 | ss_latest = -1; 78 | } 79 | 80 | /** 81 | * Returns whether the current snapshot exists 82 | * 83 | * @return Whether the current snapshot exists 84 | */ 85 | BOOL wii_snapshot_current_exists() { 86 | if (ss_exists == -1) { 87 | if (!wii_last_rom) { 88 | ss_exists = FALSE; 89 | } else { 90 | savename[0] = '\0'; 91 | wii_snapshot_handle_get_name(wii_last_rom, savename); 92 | ss_exists = Util_fileexists(savename); 93 | } 94 | } 95 | 96 | return ss_exists; 97 | } 98 | 99 | /** 100 | * Determines the index of the latest snapshot 101 | * 102 | * @return The index of the latest snapshot 103 | */ 104 | static int get_latest_snapshot() { 105 | if (ss_latest == -1 && wii_last_rom) { 106 | ss_latest = -2; // The check has been performed 107 | time_t max = 0; 108 | for (int i = 0; i < MAX_SNAPSHOTS; i++) { 109 | savename[0] = '\0'; 110 | get_snapshot_name(wii_last_rom, i, savename); 111 | struct stat st; 112 | if (stat(savename, &st) == 0) { 113 | if (st.st_mtime > max) { 114 | max = st.st_mtime; 115 | ss_latest = i; 116 | } 117 | } 118 | } 119 | } 120 | return ss_latest; 121 | } 122 | 123 | /** 124 | * Returns the name of the snapshot associated with the specified romfile and 125 | * the current snapshot index 126 | * 127 | * @param romfile The rom file 128 | * @param buffer The output buffer to receive the name of the snapshot file 129 | * (length must be WII_MAX_PATH) 130 | */ 131 | void wii_snapshot_handle_get_name(const char* romfile, char* buffer) { 132 | get_snapshot_name(romfile, ss_index, buffer); 133 | } 134 | 135 | /** 136 | * Attempts to save the snapshot to the specified file name 137 | * 138 | * @param The name to save the snapshot to 139 | * @return Whether the snapshot was successful 140 | */ 141 | BOOL wii_snapshot_handle_save(char* filename) { 142 | wii_snapshot_refresh(); // force recheck 143 | return SaveSTA(filename); 144 | } 145 | 146 | /** 147 | * Resets snapshot related information. This method is typically invoked when 148 | * a new rom file is loaded. 149 | * 150 | * @param setIndexToLatest Whether to set the snapshot index to the latest for 151 | * the current rom 152 | */ 153 | void wii_snapshot_reset(BOOL setIndexToLatest) { 154 | ss_index = 0; 155 | wii_snapshot_refresh(); 156 | if (setIndexToLatest) { 157 | int latest = get_latest_snapshot(); 158 | if (latest > 0) { 159 | ss_index = latest; 160 | } 161 | } 162 | } 163 | 164 | /** 165 | * Returns the index of the current snapshot. 166 | * 167 | * @param isLatest (out) Whether the current snapshot index is the latest 168 | * snapshot (most recent) 169 | * @return The index of the current snapshot 170 | */ 171 | int wii_snapshot_current_index(BOOL* isLatest) { 172 | *isLatest = (ss_index == get_latest_snapshot()); 173 | return ss_index; 174 | } 175 | 176 | /** 177 | * Moves to the next snapshot (next index) 178 | * 179 | * @return The index that was moved to 180 | */ 181 | int wii_snapshot_next() { 182 | if (++ss_index == MAX_SNAPSHOTS) { 183 | ss_index = 0; 184 | } 185 | wii_snapshot_refresh(); // force recheck 186 | 187 | return ss_index; 188 | } 189 | 190 | /** 191 | * Starts emulation with the current snapshot 192 | * 193 | * @return Whether emulation was successfully started 194 | */ 195 | BOOL wii_start_snapshot() { 196 | if (!wii_last_rom) { 197 | return FALSE; 198 | } 199 | wii_snapshot_refresh(); // force recheck 200 | 201 | savename[0] = '\0'; 202 | wii_snapshot_handle_get_name(wii_last_rom, savename); 203 | return wii_start_emulation(wii_last_rom, savename, FALSE, FALSE); 204 | } 205 | -------------------------------------------------------------------------------- /src/wii/wii_coleco_snapshot.h: -------------------------------------------------------------------------------- 1 | //---------------------------------------------------------------------------// 2 | // __ __.__.___________ .__ // 3 | // / \ / \__|__\_ ___ \ ____ | | ____ _____ // 4 | // \ \/\/ / | / \ \/ / _ \| | _/ __ \ / \ // 5 | // \ /| | \ \___( <_> ) |_\ ___/| Y Y \ // 6 | // \__/\ / |__|__|\______ /\____/|____/\___ >__|_| / // 7 | // \/ \/ \/ \/ // 8 | // WiiColem by raz0red // 9 | // Port of the ColEm emulator by Marat Fayzullin // 10 | // // 11 | // [github.com/raz0red/wiicolem] // 12 | // // 13 | //---------------------------------------------------------------------------// 14 | // // 15 | // Copyright (C) 2019 raz0red // 16 | // // 17 | // The license for ColEm as indicated by Marat Fayzullin, the author of // 18 | // ColEm is detailed below: // 19 | // // 20 | // ColEm sources are available under three conditions: // 21 | // // 22 | // 1) You are not using them for a commercial project. // 23 | // 2) You provide a proper reference to Marat Fayzullin as the author of // 24 | // the original source code. // 25 | // 3) You provide a link to http://fms.komkon.org/ColEm/ // 26 | // // 27 | //---------------------------------------------------------------------------// 28 | 29 | #ifndef WII_COLECO_SNAPSHOT_H 30 | #define WII_COLECO_SNAPSHOT_H 31 | 32 | /** 33 | * Starts emulation with the current snapshot 34 | * 35 | * @return Whether emulation was successfully started 36 | */ 37 | BOOL wii_start_snapshot(); 38 | 39 | /** 40 | * Resets snapshot related information. This method is typically invoked when 41 | * a new rom file is loaded. 42 | * 43 | * @param setIndexToLatest Whether to set the snapshot index to the latest for 44 | * the current rom 45 | */ 46 | void wii_snapshot_reset(BOOL setIndexToLatest = FALSE); 47 | 48 | /** 49 | * Refreshes state of snapshot (does it exist, etc.) 50 | */ 51 | void wii_snapshot_refresh(); 52 | 53 | /** 54 | * Returns the index of the current snapshot. 55 | * 56 | * @param isLatest (out) Whether the current snapshot index is the latest 57 | * snapshot (most recent) 58 | * @return The index of the current snapshot 59 | */ 60 | int wii_snapshot_current_index(BOOL* isLatest); 61 | 62 | /** 63 | * Returns whether the current snapshot exists 64 | * 65 | * @return Whether the current snapshot exists 66 | */ 67 | BOOL wii_snapshot_current_exists(); 68 | 69 | /** 70 | * Moves to the next snapshot (next index) 71 | * 72 | * @return The index that was moved to 73 | */ 74 | int wii_snapshot_next(); 75 | 76 | #endif 77 | --------------------------------------------------------------------------------