├── Makefile ├── Makefile.gc ├── Makefile.wii ├── README.txt ├── hbc ├── icon.png └── meta.xml └── source ├── button_mapping.c ├── button_mapping.h ├── cheatmgr.cpp ├── cheatmgr.h ├── fceugx.cpp ├── fceugx.h ├── fceuload.cpp ├── fceuload.h ├── fceultra ├── asm.cpp ├── asm.h ├── boards │ ├── 01-222.cpp │ ├── 09-034a.cpp │ ├── 103.cpp │ ├── 106.cpp │ ├── 108.cpp │ ├── 112.cpp │ ├── 116.cpp │ ├── 117.cpp │ ├── 120.cpp │ ├── 121.cpp │ ├── 12in1.cpp │ ├── 15.cpp │ ├── 151.cpp │ ├── 156.cpp │ ├── 158B.cpp │ ├── 164.cpp │ ├── 168.cpp │ ├── 170.cpp │ ├── 175.cpp │ ├── 176.cpp │ ├── 177.cpp │ ├── 178.cpp │ ├── 18.cpp │ ├── 183.cpp │ ├── 185.cpp │ ├── 186.cpp │ ├── 187.cpp │ ├── 189.cpp │ ├── 190.cpp │ ├── 193.cpp │ ├── 199.cpp │ ├── 206.cpp │ ├── 208.cpp │ ├── 222.cpp │ ├── 225.cpp │ ├── 228.cpp │ ├── 230.cpp │ ├── 232.cpp │ ├── 234.cpp │ ├── 235.cpp │ ├── 244.cpp │ ├── 246.cpp │ ├── 252.cpp │ ├── 253.cpp │ ├── 28.cpp │ ├── 32.cpp │ ├── 33.cpp │ ├── 34.cpp │ ├── 36.cpp │ ├── 3d-block.cpp │ ├── 40.cpp │ ├── 41.cpp │ ├── 411120-c.cpp │ ├── 42.cpp │ ├── 43.cpp │ ├── 46.cpp │ ├── 50.cpp │ ├── 51.cpp │ ├── 57.cpp │ ├── 603-5052.cpp │ ├── 62.cpp │ ├── 65.cpp │ ├── 67.cpp │ ├── 68.cpp │ ├── 69.cpp │ ├── 71.cpp │ ├── 72.cpp │ ├── 77.cpp │ ├── 79.cpp │ ├── 80.cpp │ ├── 80013-B.cpp │ ├── 8157.cpp │ ├── 82.cpp │ ├── 8237.cpp │ ├── 830118C.cpp │ ├── 88.cpp │ ├── 8in1.cpp │ ├── 90.cpp │ ├── 91.cpp │ ├── 96.cpp │ ├── 99.cpp │ ├── BMW8544.cpp │ ├── F-15.cpp │ ├── __dummy_mapper.cpp │ ├── a9746.cpp │ ├── ac-08.cpp │ ├── addrlatch.cpp │ ├── ax5705.cpp │ ├── bandai.cpp │ ├── bb.cpp │ ├── bmc13in1jy110.cpp │ ├── bmc42in1r.cpp │ ├── bmc64in1nr.cpp │ ├── bmc70in1.cpp │ ├── bonza.cpp │ ├── bs-5.cpp │ ├── cheapocabra.cpp │ ├── cityfighter.cpp │ ├── coolboy.cpp │ ├── copyfami_mmc3.cpp │ ├── dance2000.cpp │ ├── datalatch.cpp │ ├── dream.cpp │ ├── edu2000.cpp │ ├── eh8813a.cpp │ ├── emu2413.c │ ├── emu2413.h │ ├── et-100.cpp │ ├── et-4320.cpp │ ├── famicombox.cpp │ ├── ffe.cpp │ ├── fk23c.cpp │ ├── ghostbusters63in1.cpp │ ├── gs-2004.cpp │ ├── gs-2013.cpp │ ├── h2288.cpp │ ├── hp10xx_hp20xx.cpp │ ├── hp898f.cpp │ ├── inlnsf.cpp │ ├── karaoke.cpp │ ├── kof97.cpp │ ├── ks7010.cpp │ ├── ks7012.cpp │ ├── ks7013.cpp │ ├── ks7016.cpp │ ├── ks7017.cpp │ ├── ks7030.cpp │ ├── ks7031.cpp │ ├── ks7032.cpp │ ├── ks7037.cpp │ ├── ks7057.cpp │ ├── le05.cpp │ ├── lh32.cpp │ ├── lh53.cpp │ ├── malee.cpp │ ├── mapinc.h │ ├── mihunche.cpp │ ├── mmc1.cpp │ ├── mmc2and4.cpp │ ├── mmc3.cpp │ ├── mmc3.h │ ├── mmc5.cpp │ ├── n106.cpp │ ├── n625092.cpp │ ├── novel.cpp │ ├── onebus.cpp │ ├── pec-586.cpp │ ├── rt-01.cpp │ ├── sa-9602b.cpp │ ├── sachen.cpp │ ├── sb-2000.cpp │ ├── sc-127.cpp │ ├── sheroes.cpp │ ├── sl1632.cpp │ ├── subor.cpp │ ├── super24.cpp │ ├── supervision.cpp │ ├── t-227-1.cpp │ ├── t-262.cpp │ ├── tengen.cpp │ ├── tf-1201.cpp │ ├── transformer.cpp │ ├── unrom512.cpp │ ├── vrc1.cpp │ ├── vrc2and4.cpp │ ├── vrc3.cpp │ ├── vrc5.cpp │ ├── vrc6.cpp │ ├── vrc7.cpp │ ├── vrc7p.cpp │ └── yoko.cpp ├── cart.cpp ├── cart.h ├── cheat.cpp ├── cheat.h ├── conddebug.cpp ├── conddebug.h ├── config.cpp ├── debug.cpp ├── debug.h ├── drawing.cpp ├── drawing.h ├── driver.h ├── emufile.cpp ├── emufile.h ├── emufile_types.h ├── fceu.cpp ├── fceu.h ├── fcoeffs.h ├── fds.cpp ├── fds.h ├── file.cpp ├── file.h ├── filter.cpp ├── filter.h ├── fir │ ├── Makefile │ ├── README │ ├── c44100ntsc.coef │ ├── c44100ntsc.h │ ├── c44100ntsc.scm │ ├── c44100pal.coef │ ├── c44100pal.h │ ├── c44100pal.scm │ ├── c48000ntsc.coef │ ├── c48000ntsc.h │ ├── c48000ntsc.scm │ ├── c48000pal.coef │ ├── c48000pal.h │ ├── c48000pal.scm │ ├── c96000ntsc.coef │ ├── c96000ntsc.h │ ├── c96000ntsc.scm │ ├── c96000pal.coef │ ├── c96000pal.h │ ├── c96000pal.scm │ └── toh.c ├── git.h ├── ines-bad.h ├── ines-correct.h ├── ines.cpp ├── ines.h ├── input.cpp ├── input.h ├── input │ ├── arkanoid.cpp │ ├── bworld.cpp │ ├── cursor.cpp │ ├── famicom3d.cpp │ ├── fkb.cpp │ ├── fkb.h │ ├── ftrainer.cpp │ ├── hypershot.cpp │ ├── mahjong.cpp │ ├── mouse.cpp │ ├── oekakids.cpp │ ├── pec586kb.cpp │ ├── powerpad.cpp │ ├── quiz.cpp │ ├── shadow.cpp │ ├── share.h │ ├── snesmouse.cpp │ ├── suborkb.cpp │ ├── suborkb.h │ ├── toprider.cpp │ ├── zapper.cpp │ └── zapper.h ├── movie.cpp ├── movie.h ├── netplay.cpp ├── netplay.h ├── nsf.cpp ├── nsf.h ├── ops.inc ├── palette.cpp ├── palette.h ├── palettes │ ├── conv.c │ ├── palettes.h │ ├── rp2c04001.h │ ├── rp2c04002.h │ ├── rp2c04003.h │ └── rp2c05004.h ├── ppu.cpp ├── ppu.h ├── pputile.inc ├── sound.cpp ├── sound.h ├── state.cpp ├── state.h ├── types-des.h ├── types.h ├── unif.cpp ├── unif.h ├── utils │ ├── ConvertUTF.c │ ├── ConvertUTF.h │ ├── backward.cpp │ ├── backward.hpp │ ├── crc32.cpp │ ├── crc32.h │ ├── endian.cpp │ ├── endian.h │ ├── general.cpp │ ├── general.h │ ├── guid.cpp │ ├── guid.h │ ├── md5.cpp │ ├── md5.h │ ├── memory.cpp │ ├── memory.h │ ├── memorystream.h │ ├── valuearray.h │ ├── xstring.cpp │ └── xstring.h ├── version.h ├── video.cpp ├── video.h ├── vsuni.cpp ├── vsuni.h ├── wave.cpp ├── wave.h ├── x6502.cpp ├── x6502.h ├── x6502abbrev.h └── x6502struct.h ├── fceuram.cpp ├── fceuram.h ├── fceustate.cpp ├── fceustate.h ├── fceusupport.cpp ├── fceusupport.h ├── filebrowser.cpp ├── filebrowser.h ├── filelist.h ├── fileop.cpp ├── fileop.h ├── fonts └── font.ttf ├── gcaudio.cpp ├── gcaudio.h ├── gcunzip.cpp ├── gcunzip.h ├── gcvideo.cpp ├── gcvideo.h ├── gui ├── gui.h ├── gui_button.cpp ├── gui_element.cpp ├── gui_filebrowser.cpp ├── gui_image.cpp ├── gui_imagedata.cpp ├── gui_keyboard.cpp ├── gui_optionbrowser.cpp ├── gui_savebrowser.cpp ├── gui_sound.cpp ├── gui_text.cpp ├── gui_trigger.cpp └── gui_window.cpp ├── images ├── battery.png ├── battery_bar.png ├── battery_red.png ├── bg_bottom.png ├── bg_game_selection.png ├── bg_game_selection_entry.png ├── bg_options.png ├── bg_options_entry.png ├── bg_preview.png ├── bg_top.png ├── button.png ├── button_arrow_down.png ├── button_arrow_down_over.png ├── button_arrow_left.png ├── button_arrow_left_over.png ├── button_arrow_right.png ├── button_arrow_right_over.png ├── button_arrow_up.png ├── button_arrow_up_over.png ├── button_gamesave.png ├── button_gamesave_blank.png ├── button_gamesave_over.png ├── button_large.png ├── button_large_over.png ├── button_long.png ├── button_long_over.png ├── button_over.png ├── button_palette.png ├── button_palette_over.png ├── button_prompt.png ├── button_prompt_over.png ├── button_short.png ├── button_short_over.png ├── button_small.png ├── button_small_over.png ├── credits_box.png ├── dialogue_box.png ├── icon_dvd.png ├── icon_folder.png ├── icon_game_cheats.png ├── icon_game_controllers.png ├── icon_game_delete.png ├── icon_game_load.png ├── icon_game_reset.png ├── icon_game_save.png ├── icon_game_settings.png ├── icon_home.png ├── icon_sd.png ├── icon_settings.png ├── icon_settings_classic.png ├── icon_settings_file.png ├── icon_settings_gamecube.png ├── icon_settings_mappings.png ├── icon_settings_menu.png ├── icon_settings_nescontroller.png ├── icon_settings_network.png ├── icon_settings_nunchuk.png ├── icon_settings_screenshot.png ├── icon_settings_video.png ├── icon_settings_wiimote.png ├── icon_settings_wiiupro.png ├── icon_settings_zapper.png ├── icon_smb.png ├── icon_usb.png ├── keyboard_key.png ├── keyboard_key_over.png ├── keyboard_largekey.png ├── keyboard_largekey_over.png ├── keyboard_mediumkey.png ├── keyboard_mediumkey_over.png ├── keyboard_textbox.png ├── logo.png ├── logo_over.png ├── player1_grab.png ├── player1_point.png ├── player2_grab.png ├── player2_point.png ├── player3_grab.png ├── player3_point.png ├── player4_grab.png ├── player4_point.png ├── progressbar.png ├── progressbar_empty.png ├── progressbar_outline.png ├── screen_position.png ├── scrollbar.png ├── scrollbar_arrowdown.png ├── scrollbar_arrowdown_over.png ├── scrollbar_arrowup.png ├── scrollbar_arrowup_over.png ├── scrollbar_box.png ├── scrollbar_box_over.png └── throbber.png ├── lang ├── ca.lang ├── de.lang ├── en.lang ├── es.lang ├── fr.lang ├── it.lang ├── jp.lang ├── ko.lang ├── nl.lang ├── pt.lang ├── pt_br.lang ├── tr.lang └── zh.lang ├── memfile.cpp ├── memfile.h ├── menu.cpp ├── menu.h ├── networkop.cpp ├── networkop.h ├── pad.cpp ├── pad.h ├── patch.cpp ├── patch.h ├── pocketnes ├── goombasav.cpp ├── goombasav.h ├── minilzo │ ├── COPYING │ ├── README.LZO │ ├── lzoconf.h │ ├── lzodefs.h │ ├── minilzo.cpp │ └── minilzo.h ├── pocketnesrom.cpp └── pocketnesrom.h ├── preferences.cpp ├── preferences.h ├── sounds ├── bg_music.ogg ├── button_click.pcm ├── button_over.pcm ├── enter.ogg └── exit.ogg ├── utils ├── FreeTypeGX.cpp ├── FreeTypeGX.h ├── gettext.cpp ├── gettext.h ├── memory.cpp ├── memory.h ├── memorystream.h ├── oggplayer.c ├── oggplayer.h ├── pngu.c ├── pngu.h ├── sz │ ├── 7zAlloc.c │ ├── 7zAlloc.h │ ├── 7zBuffer.c │ ├── 7zBuffer.h │ ├── 7zCrc.c │ ├── 7zCrc.h │ ├── 7zDecode.c │ ├── 7zDecode.h │ ├── 7zExtract.c │ ├── 7zExtract.h │ ├── 7zHeader.c │ ├── 7zHeader.h │ ├── 7zIn.c │ ├── 7zIn.h │ ├── 7zItem.c │ ├── 7zItem.h │ ├── 7zMethodID.c │ ├── 7zMethodID.h │ ├── 7zTypes.h │ ├── LzmaDecode.c │ ├── LzmaDecode.h │ └── LzmaTypes.h ├── unzip │ ├── crypt.h │ ├── ioapi.c │ ├── ioapi.h │ ├── miniunz.cpp │ ├── miniunz.h │ ├── unzip.c │ └── unzip.h └── vm │ ├── asm.h │ ├── dsihandler.s │ ├── vm.c │ └── vm.h ├── vmalloc.cpp └── vmalloc.h /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY = all wii gc wii-clean gc-clean wii-run gc-run 2 | 3 | all: wii gc 4 | 5 | clean: wii-clean gc-clean 6 | 7 | wii: 8 | $(MAKE) -f Makefile.wii 9 | 10 | wii-clean: 11 | $(MAKE) -f Makefile.wii clean 12 | 13 | wii-run: 14 | $(MAKE) -f Makefile.wii run 15 | 16 | gc: 17 | $(MAKE) -f Makefile.gc 18 | 19 | gc-clean: 20 | $(MAKE) -f Makefile.gc clean 21 | 22 | gc-run: 23 | $(MAKE) -f Makefile.gc run 24 | -------------------------------------------------------------------------------- /hbc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/hbc/icon.png -------------------------------------------------------------------------------- /hbc/meta.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | FCE Ultra RX 4 | NiuuS, Tantric 5 | 1.7.0 6 | 20190119 7 | Nintendo Emulator 8 | Featuring: 9 | - Screenshot/Cover/Artwork display. 10 | - Sharp and soft filters. 11 | - Wii U Pro Controller support. 12 | - Classic Controllers support (NES / SNES) 13 | - Wiiflow plugin mode. 14 | - Screenshot button. 15 | - New palettes: Smooth / PVM Style D93 / Composite NTSC 16 | NES Classic / Wii Virtual Console / PlayChoice-10 /PAL 17 | Sony CXA2025AS / NESCAP / HYBRID / Wavebeam / VS. System 18 | 19 | 20 | -------------------------------------------------------------------------------- /source/button_mapping.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * michniewski August 2008 6 | * Tantric 2008-2009 7 | * 8 | * button_mapping.h 9 | * 10 | * Controller button mapping 11 | ****************************************************************************/ 12 | 13 | #ifndef BTN_MAP_H 14 | #define BTN_MAP_H 15 | 16 | enum { 17 | CTRLR_NONE = -1, 18 | CTRLR_GCPAD, 19 | CTRLR_WIIMOTE, 20 | CTRLR_NUNCHUK, 21 | CTRLR_CLASSIC 22 | }; 23 | 24 | const char ctrlrName[4][20] = 25 | { "GameCube Controller", "Wiimote", "Nunchuk + Wiimote", "Classic Controller" }; 26 | 27 | typedef struct _btn_map { 28 | u32 btn; // button 'id' 29 | char* name; // button name 30 | } BtnMap; 31 | 32 | typedef struct _ctrlr_map { 33 | u16 type; // controller type 34 | int num_btns; // number of buttons on the controller 35 | BtnMap map[15]; // controller button map 36 | } CtrlrMap; 37 | 38 | extern CtrlrMap ctrlr_def[4]; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /source/cheatmgr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2009 6 | * 7 | * cheatmgr.h 8 | * 9 | * Cheat handling 10 | ***************************************************************************/ 11 | 12 | void SetupCheats(); 13 | bool FindGameGenie(); 14 | void OpenGameGenie(); 15 | 16 | extern int numcheats; 17 | -------------------------------------------------------------------------------- /source/fceuload.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2008-2009 6 | * 7 | * fceuload.h 8 | * 9 | * NES Memory Load Game 10 | ****************************************************************************/ 11 | 12 | int GCMemROM(int size); 13 | extern bool romLoaded; 14 | -------------------------------------------------------------------------------- /source/fceultra/asm.h: -------------------------------------------------------------------------------- 1 | int Assemble(unsigned char *output, int addr, char *str); 2 | char *Disassemble(int addr, uint8 *opcode); 3 | -------------------------------------------------------------------------------- /source/fceultra/boards/108.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REG" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg8(0x6000, reg); 33 | setprg32(0x8000, ~0); 34 | setchr8(0); 35 | } 36 | 37 | static DECLFW(M108Write) { 38 | reg = V; 39 | Sync(); 40 | } 41 | 42 | static void M108Power(void) { 43 | Sync(); 44 | SetReadHandler(0x6000, 0x7FFF, CartBR); 45 | SetReadHandler(0x8000, 0xFFFF, CartBR); 46 | SetWriteHandler(0x8000, 0x8FFF, M108Write); // regular 108 47 | SetWriteHandler(0xF000, 0xFFFF, M108Write); // simplified Kaiser BB Hack 48 | } 49 | 50 | static void StateRestore(int version) { 51 | Sync(); 52 | } 53 | 54 | void Mapper108_Init(CartInfo *info) { 55 | info->Power = M108Power; 56 | GameStateRestore = StateRestore; 57 | AddExState(&StateRegs, ~0, 0, 0); 58 | } 59 | -------------------------------------------------------------------------------- /source/fceultra/boards/120.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REG" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg8(0x6000, reg); 33 | setprg32(0x8000, 2); 34 | setchr8(0); 35 | } 36 | 37 | static DECLFW(M120Write) { 38 | if (A == 0x41FF) { 39 | reg = V & 7; 40 | Sync(); 41 | } 42 | } 43 | 44 | static void M120Power(void) { 45 | reg = 0; 46 | Sync(); 47 | SetReadHandler(0x6000, 0xFFFF, CartBR); 48 | SetWriteHandler(0x4100, 0x5FFF, M120Write); 49 | } 50 | 51 | static void StateRestore(int version) { 52 | Sync(); 53 | } 54 | 55 | void Mapper120_Init(CartInfo *info) { 56 | info->Power = M120Power; 57 | GameStateRestore = StateRestore; 58 | AddExState(&StateRegs, ~0, 0, 0); 59 | } 60 | -------------------------------------------------------------------------------- /source/fceultra/boards/151.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 regs[8]; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { regs, 8, "REGS" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg8(0x8000, regs[0]); 33 | setprg8(0xA000, regs[2]); 34 | setprg8(0xC000, regs[4]); 35 | setprg8(0xE000, ~0); 36 | setchr4(0x0000, regs[6]); 37 | setchr4(0x1000, regs[7]); 38 | } 39 | 40 | static DECLFW(M151Write) { 41 | regs[(A >> 12) & 7] = V; 42 | Sync(); 43 | } 44 | 45 | static void M151Power(void) { 46 | Sync(); 47 | SetReadHandler(0x8000, 0xFFFF, CartBR); 48 | SetWriteHandler(0x8000, 0xFFFF, M151Write); 49 | } 50 | 51 | static void StateRestore(int version) { 52 | Sync(); 53 | } 54 | 55 | void Mapper151_Init(CartInfo *info) { 56 | info->Power = M151Power; 57 | GameStateRestore = StateRestore; 58 | AddExState(&StateRegs, ~0, 0, 0); 59 | } 60 | -------------------------------------------------------------------------------- /source/fceultra/boards/158B.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2015 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * "Blood Of Jurassic" protected MMC3 based board (GD-98 Cart ID, 158B PCB ID) 21 | * 22 | */ 23 | 24 | #include "mapinc.h" 25 | #include "mmc3.h" 26 | 27 | static uint8 lut[8] = { 0x00, 0x00, 0x00, 0x01, 0x02, 0x04, 0x0F, 0x00 }; 28 | 29 | static void UNL158BPW(uint32 A, uint8 V) { 30 | if (EXPREGS[0] & 0x80) { 31 | uint32 bank = EXPREGS[0] & 7; 32 | if(EXPREGS[0] & 0x20) { // 32Kb mode 33 | setprg32(0x8000, bank >> 1); 34 | } else { // 16Kb mode 35 | setprg16(0x8000, bank); 36 | setprg16(0xC000, bank); 37 | } 38 | } else { 39 | setprg8(A, V & 0xF); 40 | } 41 | } 42 | 43 | static DECLFW(UNL158BProtWrite) { 44 | EXPREGS[A & 7] = V; 45 | switch(A & 7) { 46 | case 0: 47 | FixMMC3PRG(MMC3_cmd); 48 | break; 49 | case 7: 50 | FCEU_printf("UNK PROT WRITE\n"); 51 | break; 52 | } 53 | 54 | } 55 | 56 | static DECLFR(UNL158BProtRead) { 57 | return X.DB | lut[A & 7]; 58 | } 59 | 60 | static void UNL158BPower(void) { 61 | GenMMC3Power(); 62 | SetWriteHandler(0x5000, 0x5FFF, UNL158BProtWrite); 63 | SetReadHandler(0x5000, 0x5FFF, UNL158BProtRead); 64 | } 65 | 66 | void UNL158B_Init(CartInfo *info) { 67 | GenMMC3_Init(info, 128, 128, 0, 0); 68 | pwrap = UNL158BPW; 69 | info->Power = UNL158BPower; 70 | AddExState(EXPREGS, 8, 0, "EXPR"); 71 | } 72 | -------------------------------------------------------------------------------- /source/fceultra/boards/170.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2011 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REGS" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg16(0x8000, 0); 33 | setprg16(0xc000, ~0); 34 | setchr8(0); 35 | } 36 | 37 | static DECLFW(M170ProtW) { 38 | reg = V << 1 & 0x80; 39 | } 40 | 41 | static DECLFR(M170ProtR) { 42 | return reg | (X.DB & 0x7F); 43 | } 44 | 45 | static void M170Power(void) { 46 | Sync(); 47 | SetWriteHandler(0x6502, 0x6502, M170ProtW); 48 | SetWriteHandler(0x7000, 0x7000, M170ProtW); 49 | SetReadHandler(0x7001, 0x7001, M170ProtR); 50 | SetReadHandler(0x7777, 0x7777, M170ProtR); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | } 53 | 54 | static void StateRestore(int version) { 55 | Sync(); 56 | } 57 | 58 | void Mapper170_Init(CartInfo *info) { 59 | info->Power = M170Power; 60 | GameStateRestore = StateRestore; 61 | AddExState(&StateRegs, ~0, 0, 0); 62 | } 63 | -------------------------------------------------------------------------------- /source/fceultra/boards/175.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg, delay, mirr; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REG" }, 28 | { &mirr, 1, "MIRR" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setchr8(reg); 34 | if (!delay) { 35 | setprg16(0x8000, reg); 36 | setprg8(0xC000, reg << 1); 37 | } 38 | setprg8(0xE000, (reg << 1) + 1); 39 | setmirror(((mirr & 4) >> 2) ^ 1); 40 | } 41 | 42 | static DECLFW(M175Write1) { 43 | mirr = V; 44 | delay = 1; 45 | Sync(); 46 | } 47 | 48 | static DECLFW(M175Write2) { 49 | reg = V & 0x0F; 50 | delay = 1; 51 | Sync(); 52 | } 53 | 54 | static DECLFR(M175Read) { 55 | if (A == 0xFFFC) { 56 | delay = 0; 57 | Sync(); 58 | } 59 | return CartBR(A); 60 | } 61 | 62 | static void M175Power(void) { 63 | reg = mirr = delay = 0; 64 | SetReadHandler(0x8000, 0xFFFF, M175Read); 65 | SetWriteHandler(0x8000, 0x8000, M175Write1); 66 | SetWriteHandler(0xA000, 0xA000, M175Write2); 67 | Sync(); 68 | } 69 | 70 | static void StateRestore(int version) { 71 | Sync(); 72 | } 73 | 74 | void Mapper175_Init(CartInfo *info) { 75 | info->Power = M175Power; 76 | GameStateRestore = StateRestore; 77 | 78 | AddExState(&StateRegs, ~0, 0, 0); 79 | } 80 | -------------------------------------------------------------------------------- /source/fceultra/boards/189.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | #include "mmc3.h" 23 | 24 | static void M189PW(uint32 A, uint8 V) { 25 | setprg32(0x8000, EXPREGS[0] & 7); 26 | } 27 | 28 | static DECLFW(M189Write) { 29 | EXPREGS[0] = V | (V >> 4); //actually, there is a two versions of 189 mapper with hi or lo bits bankswitching. 30 | FixMMC3PRG(MMC3_cmd); 31 | } 32 | 33 | static void M189Power(void) { 34 | EXPREGS[0] = EXPREGS[1] = 0; 35 | GenMMC3Power(); 36 | SetWriteHandler(0x4120, 0x7FFF, M189Write); 37 | } 38 | 39 | void Mapper189_Init(CartInfo *info) { 40 | GenMMC3_Init(info, 256, 256, 0, 0); 41 | pwrap = M189PW; 42 | info->Power = M189Power; 43 | AddExState(EXPREGS, 2, 0, "EXPR"); 44 | } 45 | -------------------------------------------------------------------------------- /source/fceultra/boards/193.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2009 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg[8]; 24 | static uint8 mirror, cmd, bank; 25 | 26 | static SFORMAT StateRegs[] = 27 | { 28 | { &cmd, 1, "CMD" }, 29 | { &mirror, 1, "MIRR" }, 30 | { &bank, 1, "BANK" }, 31 | { reg, 8, "REGS" }, 32 | { 0 } 33 | }; 34 | 35 | static void Sync(void) { 36 | setmirror(mirror ^ 1); 37 | setprg8(0x8000, reg[3]); 38 | setprg8(0xA000, 0xD); 39 | setprg8(0xC000, 0xE); 40 | setprg8(0xE000, 0xF); 41 | setchr4(0x0000, reg[0] >> 2); 42 | setchr2(0x1000, reg[1] >> 1); 43 | setchr2(0x1800, reg[2] >> 1); 44 | } 45 | 46 | static DECLFW(M193Write) { 47 | reg[A & 3] = V; 48 | Sync(); 49 | } 50 | 51 | static void M193Power(void) { 52 | bank = 0; 53 | Sync(); 54 | SetWriteHandler(0x6000, 0x6003, M193Write); 55 | SetReadHandler(0x8000, 0xFFFF, CartBR); 56 | SetWriteHandler(0x8000, 0xFFFF, CartBW); 57 | } 58 | 59 | static void M193Reset(void) { 60 | } 61 | 62 | static void StateRestore(int version) { 63 | Sync(); 64 | } 65 | 66 | void Mapper193_Init(CartInfo *info) { 67 | info->Reset = M193Reset; 68 | info->Power = M193Power; 69 | GameStateRestore = StateRestore; 70 | AddExState(&StateRegs, ~0, 0, 0); 71 | } 72 | -------------------------------------------------------------------------------- /source/fceultra/boards/206.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 cmd; 24 | static uint8 DRegs[8]; 25 | 26 | static SFORMAT StateRegs[] = 27 | { 28 | { &cmd, 1, "CMD" }, 29 | { DRegs, 8, "DREG" }, 30 | { 0 } 31 | }; 32 | 33 | static void Sync(void) { 34 | setchr2(0x0000, DRegs[0]); 35 | setchr2(0x0800, DRegs[1]); 36 | int x; 37 | for (x = 0; x < 4; x++) 38 | setchr1(0x1000 + (x << 10), DRegs[2 + x]); 39 | setprg8(0x8000, DRegs[6]); 40 | setprg8(0xa000, DRegs[7]); 41 | setprg8(0xc000, ~1); 42 | setprg8(0xe000, ~0); 43 | } 44 | 45 | static void StateRestore(int version) { 46 | Sync(); 47 | } 48 | 49 | static DECLFW(M206Write) { 50 | switch (A & 0x8001) { 51 | case 0x8000: cmd = V & 0x07; break; 52 | case 0x8001: 53 | if (cmd <= 0x05) 54 | V &= 0x3F; 55 | else 56 | V &= 0x0F; 57 | if (cmd <= 0x01) V >>= 1; 58 | DRegs[cmd & 0x07] = V; 59 | Sync(); 60 | break; 61 | } 62 | } 63 | 64 | static void M206Power(void) { 65 | cmd = 0; 66 | DRegs[6] = 0; 67 | DRegs[7] = 1; 68 | Sync(); 69 | SetReadHandler(0x8000, 0xFFFF, CartBR); 70 | SetWriteHandler(0x8000, 0xFFFF, M206Write); 71 | } 72 | 73 | 74 | void Mapper206_Init(CartInfo *info) { 75 | info->Power = M206Power; 76 | GameStateRestore = StateRestore; 77 | AddExState(&StateRegs, ~0, 0, 0); 78 | } 79 | -------------------------------------------------------------------------------- /source/fceultra/boards/230.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * Copyright (C) 2009 qeed 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | * 21 | * 22 + Contra Reset based custom mapper... 22 | * 23 | */ 24 | 25 | #include "mapinc.h" 26 | 27 | static uint8 latche, reset; 28 | static SFORMAT StateRegs[] = 29 | { 30 | { &reset, 1, "RST" }, 31 | { &latche, 1, "LATC" }, 32 | { 0 } 33 | }; 34 | 35 | static void Sync(void) { 36 | if(reset) { 37 | setprg16(0x8000, latche & 7); 38 | setprg16(0xC000, 7); 39 | setmirror(MI_V); 40 | } else { 41 | uint32 bank = (latche & 0x1F) + 8; 42 | if (latche & 0x20) { 43 | setprg16(0x8000, bank); 44 | setprg16(0xC000, bank); 45 | } else 46 | setprg32(0x8000, bank >> 1); 47 | setmirror((latche >> 6) & 1); 48 | } 49 | setchr8(0); 50 | } 51 | 52 | static DECLFW(M230Write) { 53 | latche = V; 54 | Sync(); 55 | } 56 | 57 | static void M230Reset(void) { 58 | reset ^= 1; 59 | Sync(); 60 | } 61 | 62 | static void M230Power(void) { 63 | latche = reset = 0; 64 | Sync(); 65 | SetWriteHandler(0x8000, 0xFFFF, M230Write); 66 | SetReadHandler(0x8000, 0xFFFF, CartBR); 67 | } 68 | 69 | static void StateRestore(int version) { 70 | Sync(); 71 | } 72 | 73 | void Mapper230_Init(CartInfo *info) { 74 | info->Power = M230Power; 75 | info->Reset = M230Reset; 76 | AddExState(&StateRegs, ~0, 0, 0); 77 | GameStateRestore = StateRestore; 78 | } 79 | -------------------------------------------------------------------------------- /source/fceultra/boards/232.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 bank, preg; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { &bank, 1, "BANK" }, 27 | { &preg, 1, "PREG" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | // uint32 bbank = (bank & 0x18) >> 1; 33 | uint32 bbank = ((bank & 0x10) >> 2) | (bank & 8); // some dumps have bbanks swapped, if swap commands, 34 | // then all roms can be played, but with some swapped 35 | // games in menu. if not, some dumps are unplayable 36 | // make hard dump for both cart types to check 37 | setprg16(0x8000, bbank | (preg & 3)); 38 | setprg16(0xC000, bbank | 3); 39 | setchr8(0); 40 | } 41 | 42 | static DECLFW(M232WriteBank) { 43 | bank = V; 44 | Sync(); 45 | } 46 | 47 | static DECLFW(M232WritePreg) { 48 | preg = V; 49 | Sync(); 50 | } 51 | 52 | static void M232Power(void) { 53 | bank = preg = 0; 54 | Sync(); 55 | SetWriteHandler(0x8000, 0xBFFF, M232WriteBank); 56 | SetWriteHandler(0xC000, 0xFFFF, M232WritePreg); 57 | SetReadHandler(0x8000, 0xFFFF, CartBR); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void Mapper232_Init(CartInfo *info) { 65 | info->Power = M232Power; 66 | AddExState(&StateRegs, ~0, 0, 0); 67 | GameStateRestore = StateRestore; 68 | } 69 | -------------------------------------------------------------------------------- /source/fceultra/boards/234.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 bank, preg; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { &bank, 1, "BANK" }, 27 | { &preg, 1, "PREG" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | if (bank & 0x40) { 33 | setprg32(0x8000, (bank & 0xE) | (preg & 1)); 34 | setchr8(((bank & 0xE) << 2) | ((preg >> 4) & 7)); 35 | } else { 36 | setprg32(0x8000, bank & 0xF); 37 | setchr8(((bank & 0xF) << 2) | ((preg >> 4) & 3)); 38 | } 39 | setmirror((bank >> 7) ^ 1); 40 | } 41 | 42 | DECLFR(M234ReadBank) { 43 | uint8 r = CartBR(A); 44 | if (!bank) { 45 | bank = r; 46 | Sync(); 47 | } 48 | return r; 49 | } 50 | 51 | DECLFR(M234ReadPreg) { 52 | uint8 r = CartBR(A); 53 | preg = r; 54 | Sync(); 55 | return r; 56 | } 57 | 58 | static void M234Reset(void) { 59 | bank = preg = 0; 60 | Sync(); 61 | } 62 | 63 | static void M234Power(void) { 64 | M234Reset(); 65 | SetReadHandler(0x8000, 0xFFFF, CartBR); 66 | SetReadHandler(0xFF80, 0xFF9F, M234ReadBank); 67 | SetReadHandler(0xFFE8, 0xFFF7, M234ReadPreg); 68 | } 69 | 70 | static void StateRestore(int version) { 71 | Sync(); 72 | } 73 | 74 | void Mapper234_Init(CartInfo *info) { 75 | info->Power = M234Power; 76 | info->Reset = M234Reset; 77 | AddExState(&StateRegs, ~0, 0, 0); 78 | GameStateRestore = StateRestore; 79 | } 80 | -------------------------------------------------------------------------------- /source/fceultra/boards/235.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint16 cmdreg; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { &cmdreg, 2, "CREG" }, 27 | { 0 } 28 | }; 29 | 30 | static void Sync(void) { 31 | if (cmdreg & 0x400) 32 | setmirror(MI_0); 33 | else 34 | setmirror(((cmdreg >> 13) & 1) ^ 1); 35 | if (cmdreg & 0x800) { 36 | setprg16(0x8000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1)); 37 | setprg16(0xC000, ((cmdreg & 0x300) >> 3) | ((cmdreg & 0x1F) << 1) | ((cmdreg >> 12) & 1)); 38 | } else 39 | setprg32(0x8000, ((cmdreg & 0x300) >> 4) | (cmdreg & 0x1F)); 40 | } 41 | 42 | static DECLFW(M235Write) { 43 | cmdreg = A; 44 | Sync(); 45 | } 46 | 47 | static void M235Power(void) { 48 | setchr8(0); 49 | SetWriteHandler(0x8000, 0xFFFF, M235Write); 50 | SetReadHandler(0x8000, 0xFFFF, CartBR); 51 | cmdreg = 0; 52 | Sync(); 53 | } 54 | 55 | static void M235Restore(int version) { 56 | Sync(); 57 | } 58 | 59 | void Mapper235_Init(CartInfo *info) { 60 | info->Power = M235Power; 61 | GameStateRestore = M235Restore; 62 | AddExState(&StateRegs, ~0, 0, 0); 63 | } 64 | -------------------------------------------------------------------------------- /source/fceultra/boards/36.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * TXC/Micro Genius simplified mapper 21 | */ 22 | 23 | #include "mapinc.h" 24 | 25 | static uint8 latche, mirr; 26 | 27 | static SFORMAT StateRegs[] = 28 | { 29 | { &latche, 1, "LATC" }, 30 | { &mirr, 1, "MIRR" }, 31 | { 0 } 32 | }; 33 | 34 | static void Sync(void) { 35 | setprg32(0x8000, latche >> 4); 36 | setchr8(latche & 0xf); 37 | } 38 | 39 | static DECLFW(M36Write) { 40 | 41 | switch((A>>12)&7) { // need to 4-in-1 MGC-26 BMC, doesnt break other games though 42 | case 0: mirr = MI_V; setmirror(mirr); break; 43 | case 4: mirr = MI_H; setmirror(mirr); break; 44 | } 45 | latche = V; 46 | Sync(); 47 | } 48 | 49 | static DECLFR(M36Read) { 50 | return latche; // Need by Strike Wolf, being simplified mapper, this cart still uses some TCX mapper features andrely on it 51 | } 52 | 53 | static void M36Power(void) { 54 | latche = 0; 55 | Sync(); 56 | SetReadHandler(0x4100, 0x4100, M36Read); 57 | SetReadHandler(0x8000, 0xFFFF, CartBR); 58 | SetWriteHandler(0x8000, 0xFFFE, M36Write); // Actually, BUS conflict there preventing from triggering the wrong banks 59 | } 60 | 61 | static void M36Restore(int version) { 62 | Sync(); 63 | } 64 | 65 | void Mapper36_Init(CartInfo *info) { 66 | info->Power = M36Power; 67 | GameStateRestore = M36Restore; 68 | AddExState(StateRegs, ~0, 0, 0); 69 | } 70 | -------------------------------------------------------------------------------- /source/fceultra/boards/41.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 mainreg, chrreg, mirror; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &mainreg, 1, "MREG" }, 28 | { &chrreg, 1, "CREG" }, 29 | { &mirror, 1, "MIRR" }, 30 | { 0 } 31 | }; 32 | 33 | static void Sync(void) { 34 | setprg32(0x8000, mainreg & 7); 35 | setchr8(chrreg); 36 | setmirror(mirror); 37 | } 38 | 39 | static DECLFW(M41Write0) { 40 | mainreg = A & 0xFF; 41 | mirror = ((A >> 5) & 1) ^ 1; 42 | chrreg = (chrreg & 3) | ((A >> 1) & 0xC); 43 | Sync(); 44 | } 45 | 46 | static DECLFW(M41Write1) { 47 | if (mainreg & 0x4) { 48 | chrreg = (chrreg & 0xC) | (A & 3); 49 | Sync(); 50 | } 51 | } 52 | 53 | static void M41Power(void) { 54 | mainreg = chrreg = 0; 55 | Sync(); 56 | SetReadHandler(0x8000, 0xFFFF, CartBR); 57 | SetWriteHandler(0x6000, 0x67FF, M41Write0); 58 | SetWriteHandler(0x8000, 0xFFFF, M41Write1); 59 | } 60 | 61 | static void StateRestore(int version) { 62 | Sync(); 63 | } 64 | 65 | void Mapper41_Init(CartInfo *info) { 66 | info->Power = M41Power; 67 | GameStateRestore = StateRestore; 68 | AddExState(&StateRegs, ~0, 0, 0); 69 | } 70 | -------------------------------------------------------------------------------- /source/fceultra/boards/411120-c.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2008 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | // actually cart ID is 811120-C, sorry ;) K-3094 - another ID 22 | 23 | #include "mapinc.h" 24 | #include "mmc3.h" 25 | 26 | static uint8 reset_flag = 0; 27 | 28 | static void BMC411120CCW(uint32 A, uint8 V) { 29 | setchr1(A, V | ((EXPREGS[0] & 3) << 7)); 30 | } 31 | 32 | static void BMC411120CPW(uint32 A, uint8 V) { 33 | if (EXPREGS[0] & (8 | reset_flag)) 34 | setprg32(0x8000, ((EXPREGS[0] >> 4) & 3) | (0x0C)); 35 | else 36 | setprg8(A, (V & 0x0F) | ((EXPREGS[0] & 3) << 4)); 37 | } 38 | 39 | static DECLFW(BMC411120CLoWrite) { 40 | EXPREGS[0] = A; 41 | FixMMC3PRG(MMC3_cmd); 42 | FixMMC3CHR(MMC3_cmd); 43 | } 44 | 45 | static void BMC411120CReset(void) { 46 | EXPREGS[0] = 0; 47 | reset_flag ^= 4; 48 | MMC3RegReset(); 49 | } 50 | 51 | static void BMC411120CPower(void) { 52 | EXPREGS[0] = 0; 53 | GenMMC3Power(); 54 | SetWriteHandler(0x6000, 0x7FFF, BMC411120CLoWrite); 55 | } 56 | 57 | void BMC411120C_Init(CartInfo *info) { 58 | GenMMC3_Init(info, 128, 128, 8, 0); 59 | pwrap = BMC411120CPW; 60 | cwrap = BMC411120CCW; 61 | info->Power = BMC411120CPower; 62 | info->Reset = BMC411120CReset; 63 | AddExState(EXPREGS, 1, 0, "EXPR"); 64 | } 65 | -------------------------------------------------------------------------------- /source/fceultra/boards/46.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg0, reg1; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®0, 1, "REG0" }, 28 | { ®1, 1, "REG1" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setprg32(0x8000, (reg1 & 1) + ((reg0 & 0xF) << 1)); 34 | setchr8(((reg1 >> 4) & 7) + ((reg0 & 0xF0) >> 1)); 35 | } 36 | 37 | static DECLFW(M46Write0) { 38 | reg0 = V; 39 | Sync(); 40 | } 41 | 42 | static DECLFW(M46Write1) { 43 | reg1 = V; 44 | Sync(); 45 | } 46 | 47 | static void M46Power(void) { 48 | reg0 = reg1 = 0; 49 | Sync(); 50 | SetReadHandler(0x8000, 0xFFFF, CartBR); 51 | SetWriteHandler(0x6000, 0x7FFF, M46Write0); 52 | SetWriteHandler(0x8000, 0xFFFF, M46Write1); 53 | } 54 | 55 | static void M46Reset(void) { 56 | reg0 = reg1 = 0; 57 | Sync(); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void Mapper46_Init(CartInfo *info) { 65 | info->Power = M46Power; 66 | info->Reset = M46Reset; 67 | GameStateRestore = StateRestore; 68 | AddExState(&StateRegs, ~0, 0, 0); 69 | } 70 | -------------------------------------------------------------------------------- /source/fceultra/boards/603-5052.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | #include "mmc3.h" 23 | 24 | static uint8 lut[4] = { 0x00, 0x02, 0x02, 0x03 }; 25 | 26 | static DECLFW(UNL6035052ProtWrite) { 27 | EXPREGS[0] = lut[V & 3]; 28 | } 29 | 30 | static DECLFR(UNL6035052ProtRead) { 31 | return EXPREGS[0]; 32 | } 33 | 34 | static void UNL6035052Power(void) { 35 | GenMMC3Power(); 36 | SetWriteHandler(0x4020, 0x7FFF, UNL6035052ProtWrite); 37 | SetReadHandler(0x4020, 0x7FFF, UNL6035052ProtRead); 38 | } 39 | 40 | void UNL6035052_Init(CartInfo *info) { 41 | GenMMC3_Init(info, 128, 256, 0, 0); 42 | info->Power = UNL6035052Power; 43 | AddExState(EXPREGS, 6, 0, "EXPR"); 44 | } 45 | -------------------------------------------------------------------------------- /source/fceultra/boards/62.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 bank; 24 | static uint16 mode; 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &bank, 1, "BANK" }, 28 | { &mode, 2, "MODE" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setchr8(((mode & 0x1F) << 2) | (bank & 0x03)); 34 | if (mode & 0x20) { 35 | setprg16(0x8000, (mode & 0x40) | ((mode >> 8) & 0x3F)); 36 | setprg16(0xc000, (mode & 0x40) | ((mode >> 8) & 0x3F)); 37 | } else 38 | setprg32(0x8000, ((mode & 0x40) | ((mode >> 8) & 0x3F)) >> 1); 39 | setmirror(((mode >> 7) & 1) ^ 1); 40 | } 41 | 42 | static DECLFW(M62Write) { 43 | mode = A & 0x3FFF; 44 | bank = V & 3; 45 | Sync(); 46 | } 47 | 48 | static void M62Power(void) { 49 | bank = mode = 0; 50 | Sync(); 51 | SetWriteHandler(0x8000, 0xFFFF, M62Write); 52 | SetReadHandler(0x8000, 0xFFFF, CartBR); 53 | } 54 | 55 | static void M62Reset(void) { 56 | bank = mode = 0; 57 | Sync(); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void Mapper62_Init(CartInfo *info) { 65 | info->Power = M62Power; 66 | info->Reset = M62Reset; 67 | AddExState(&StateRegs, ~0, 0, 0); 68 | GameStateRestore = StateRestore; 69 | } 70 | -------------------------------------------------------------------------------- /source/fceultra/boards/71.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 preg, mirr; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &preg, 1, "PREG" }, 28 | { &mirr, 1, "MIRR" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setprg16(0x8000, preg); 34 | setprg16(0xC000, ~0); 35 | setchr8(0); 36 | if(mirr) 37 | setmirror(mirr); 38 | } 39 | 40 | static DECLFW(M71Write) { 41 | if ((A & 0xF000) == 0x9000) 42 | mirr = MI_0 + ((V >> 4) & 1); // 2-in-1, some carts are normal hardwire V/H mirror, some uses mapper selectable 0/1 mirror 43 | else 44 | preg = V; 45 | Sync(); 46 | } 47 | 48 | static void M71Power(void) { 49 | mirr = 0; 50 | Sync(); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | SetWriteHandler(0x8000, 0xFFFF, M71Write); 53 | } 54 | 55 | static void StateRestore(int version) { 56 | Sync(); 57 | } 58 | 59 | void Mapper71_Init(CartInfo *info) { 60 | info->Power = M71Power; 61 | GameStateRestore = StateRestore; 62 | 63 | AddExState(&StateRegs, ~0, 0, 0); 64 | } 65 | -------------------------------------------------------------------------------- /source/fceultra/boards/72.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Moero!! Pro Tennis have ADPCM codec on-board, PROM isn't dumped, emulation isn't 21 | * possible just now. 22 | */ 23 | 24 | #include "mapinc.h" 25 | 26 | static uint8 preg, creg; 27 | 28 | static SFORMAT StateRegs[] = 29 | { 30 | { &preg, 1, "PREG" }, 31 | { &creg, 1, "CREG" }, 32 | { 0 } 33 | }; 34 | 35 | static void Sync(void) { 36 | setprg16(0x8000, preg); 37 | setprg16(0xC000, ~0); 38 | setchr8(creg); 39 | } 40 | 41 | static DECLFW(M72Write) { 42 | if (V & 0x80) 43 | preg = V & 0xF; 44 | if (V & 0x40) 45 | creg = V & 0xF; 46 | Sync(); 47 | } 48 | 49 | static void M72Power(void) { 50 | Sync(); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | SetWriteHandler(0x6000, 0xFFFF, M72Write); 53 | } 54 | 55 | static void StateRestore(int version) { 56 | Sync(); 57 | } 58 | 59 | void Mapper72_Init(CartInfo *info) { 60 | info->Power = M72Power; 61 | GameStateRestore = StateRestore; 62 | 63 | AddExState(&StateRegs, ~0, 0, 0); 64 | } 65 | -------------------------------------------------------------------------------- /source/fceultra/boards/77.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 latche; 24 | 25 | static uint8 *CHRRAM=NULL; 26 | static uint32 CHRRAMSIZE; 27 | 28 | static SFORMAT StateRegs[] = 29 | { 30 | { &latche, 1, "LATC" }, 31 | { 0 } 32 | }; 33 | 34 | static void Sync(void) { 35 | setprg32(0x8000, latche & 7); 36 | setchr2(0x0000, latche >> 4); 37 | setchr2r(0x10, 0x0800, 2); 38 | setchr4r(0x10, 0x1000, 0); 39 | } 40 | 41 | static DECLFW(M77Write) { 42 | latche = V; 43 | Sync(); 44 | } 45 | 46 | static void M77Power(void) { 47 | latche = 0; 48 | Sync(); 49 | SetReadHandler(0x8000, 0xFFFF, CartBR); 50 | SetWriteHandler(0x8000, 0xFFFF, M77Write); 51 | } 52 | 53 | static void M77Close(void) 54 | { 55 | if (CHRRAM) 56 | FCEU_gfree(CHRRAM); 57 | CHRRAM = NULL; 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void Mapper77_Init(CartInfo *info) { 65 | info->Power = M77Power; 66 | info->Close = M77Close; 67 | GameStateRestore = StateRestore; 68 | 69 | CHRRAMSIZE = 6 * 1024; 70 | CHRRAM = (uint8*)FCEU_gmalloc(CHRRAMSIZE); 71 | SetupCartCHRMapping(0x10, CHRRAM, CHRRAMSIZE, 1); 72 | AddExState(CHRRAM, CHRRAMSIZE, 0, "CRAM"); 73 | 74 | AddExState(&StateRegs, ~0, 0, 0); 75 | } 76 | -------------------------------------------------------------------------------- /source/fceultra/boards/79.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * Copyright (C) 2002 Xodnizel 6 | * 7 | * This program is free software; you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation; either version 2 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * This program is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with this program; if not, write to the Free Software 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 20 | */ 21 | 22 | #include "mapinc.h" 23 | 24 | static uint8 creg, preg; 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &creg, 1, "CREG" }, 28 | { &preg, 1, "PREG" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setprg32(0x8000, preg); 34 | setchr8(creg); 35 | } 36 | 37 | static DECLFW(M79Write) { 38 | if ((A < 0x8000) && ((A ^ 0x4100) == 0)) { 39 | preg = (V >> 3) & 1; 40 | } 41 | creg = V & 7; 42 | Sync(); 43 | } 44 | 45 | static void M79Power(void) { 46 | preg = ~0; 47 | Sync(); 48 | SetWriteHandler(0x4100, 0x5FFF, M79Write); 49 | SetWriteHandler(0x8000, 0xFFFF, M79Write); 50 | SetReadHandler(0x8000, 0xFFFF, CartBR); 51 | } 52 | 53 | static void StateRestore(int version) { 54 | Sync(); 55 | } 56 | 57 | void Mapper79_Init(CartInfo *info) { 58 | info->Power = M79Power; 59 | AddExState(&StateRegs, ~0, 0, 0); 60 | GameStateRestore = StateRestore; 61 | } 62 | -------------------------------------------------------------------------------- /source/fceultra/boards/80013-B.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2017 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 bios_prg, rom_prg, rom_mode, mirror; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &bios_prg, 1, "BREG" }, 28 | { &rom_prg, 1, "RREG" }, 29 | { &rom_mode, 1, "RMODE" }, 30 | { 0 } 31 | }; 32 | 33 | static void Sync(void) { 34 | setchr8(0); 35 | if(rom_mode&2) { 36 | setprg16r(0,0x8000,(bios_prg&0xF)|(rom_prg&0x70)); 37 | } else { 38 | setprg16r(1,0x8000,bios_prg&3); 39 | } 40 | setprg16r(0,0xC000,rom_prg&0x7F); 41 | setmirror(((bios_prg>>4)&1)^1); 42 | } 43 | 44 | static DECLFW(BMC80013BWrite) { 45 | uint8 reg = (A>>13)&3; 46 | if(reg == 0) { 47 | bios_prg = V; 48 | } else { 49 | rom_prg = V; 50 | rom_mode = reg; 51 | } 52 | Sync(); 53 | } 54 | 55 | static void BMC80013BPower(void) { 56 | bios_prg=rom_prg=rom_mode=mirror=0; 57 | Sync(); 58 | SetReadHandler(0x8000, 0xFFFF, CartBR); 59 | SetWriteHandler(0x8000, 0xFFFF, BMC80013BWrite); 60 | } 61 | 62 | static void BMC80013BReset(void) { 63 | bios_prg=rom_prg=rom_mode=mirror=0; 64 | Sync(); 65 | } 66 | 67 | static void StateRestore(int version) { 68 | Sync(); 69 | } 70 | 71 | void BMC80013B_Init(CartInfo *info) { 72 | info->Reset = BMC80013BReset; 73 | info->Power = BMC80013BPower; 74 | GameStateRestore = StateRestore; 75 | AddExState(&StateRegs, ~0, 0, 0); 76 | } 77 | -------------------------------------------------------------------------------- /source/fceultra/boards/8in1.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2016 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * 8-in-1 Rockin' Kats, Snake, (PCB marked as "8 in 1"), similar to 12IN1, 21 | * but with MMC3 on board, all games are hacked the same, Snake is buggy too! 22 | * 23 | * no reset-citcuit, so selected game can be reset, but to change it you must use power 24 | * 25 | */ 26 | 27 | #include "mapinc.h" 28 | #include "mmc3.h" 29 | 30 | static void BMC8IN1CW(uint32 A, uint8 V) { 31 | setchr1(A, ((EXPREGS[0] & 0xC) << 5) | (V & 0x7F)); 32 | } 33 | 34 | static void BMC8IN1PW(uint32 A, uint8 V) { 35 | if(EXPREGS[0] & 0x10) { // MMC3 mode 36 | setprg8(A, ((EXPREGS[0] & 0xC) << 2) | (V & 0xF)); 37 | } else { 38 | setprg32(0x8000, EXPREGS[0] & 0xF); 39 | } 40 | } 41 | 42 | static DECLFW(BMC8IN1Write) { 43 | if(A & 0x1000) { 44 | EXPREGS[0] = V; 45 | FixMMC3PRG(MMC3_cmd); 46 | FixMMC3CHR(MMC3_cmd); 47 | } else { 48 | if(A < 0xC000) 49 | MMC3_CMDWrite(A, V); 50 | else 51 | MMC3_IRQWrite(A, V); 52 | } 53 | } 54 | 55 | static void BMC8IN1Power(void) { 56 | EXPREGS[0] = 0; 57 | GenMMC3Power(); 58 | SetWriteHandler(0x8000, 0xFFFF, BMC8IN1Write); 59 | } 60 | 61 | void BMC8IN1_Init(CartInfo *info) { 62 | GenMMC3_Init(info, 128, 128, 0, 0); 63 | cwrap = BMC8IN1CW; 64 | pwrap = BMC8IN1PW; 65 | info->Power = BMC8IN1Power; 66 | AddExState(EXPREGS, 1, 0, "EXPR"); 67 | } 68 | -------------------------------------------------------------------------------- /source/fceultra/boards/96.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 1998 BERO 5 | * Copyright (C) 2002 Xodnizel 6 | * Copyright (C) 2012 CaH4e3 7 | * 8 | * This program is free software; you can redistribute it and/or modify 9 | * it under the terms of the GNU General Public License as published by 10 | * the Free Software Foundation; either version 2 of the License, or 11 | * (at your option) any later version. 12 | * 13 | * This program is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU General Public License for more details. 17 | * 18 | * You should have received a copy of the GNU General Public License 19 | * along with this program; if not, write to the Free Software 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 | */ 22 | 23 | #include "mapinc.h" 24 | 25 | static uint8 reg, ppulatch; 26 | 27 | static SFORMAT StateRegs[] = 28 | { 29 | { ®, 1, "REG" }, 30 | { &ppulatch, 1, "PPUL" }, 31 | { 0 } 32 | }; 33 | 34 | static void Sync(void) { 35 | setmirror(MI_0); 36 | setprg32(0x8000, reg & 3); 37 | setchr4(0x0000, (reg & 4) | ppulatch); 38 | setchr4(0x1000, (reg & 4) | 3); 39 | } 40 | 41 | static DECLFW(M96Write) { 42 | reg = V; 43 | Sync(); 44 | } 45 | 46 | static void M96Hook(uint32 A) { 47 | if ((A & 0x3000) == 0x2000) { 48 | ppulatch = (A >> 8) & 3; 49 | Sync(); 50 | } 51 | } 52 | 53 | static void M96Power(void) { 54 | reg = ppulatch = 0; 55 | Sync(); 56 | SetReadHandler(0x8000, 0xffff, CartBR); 57 | SetWriteHandler(0x8000, 0xffff, M96Write); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void Mapper96_Init(CartInfo *info) { 65 | info->Power = M96Power; 66 | PPU_hook = M96Hook; 67 | GameStateRestore = StateRestore; 68 | AddExState(&StateRegs, ~0, 0, 0); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /source/fceultra/boards/ac-08.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2011 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg, mirr; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REG" }, 28 | { &mirr, 1, "MIRR" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setprg8(0x6000, reg); 34 | setprg32r(1, 0x8000, 0); 35 | setchr8(0); 36 | setmirror(mirr); 37 | } 38 | 39 | static DECLFW(AC08Mirr) { 40 | mirr = ((V & 8) >> 3) ^ 1; 41 | Sync(); 42 | } 43 | 44 | static DECLFW(AC08Write) { 45 | if (A == 0x8001) // Green Berret bank switching is only 100x xxxx xxxx xxx1 mask 46 | reg = (V >> 1) & 0xf; 47 | else 48 | reg = V & 0xf; // Sad But True, 2-in-1 mapper, Green Berret need value shifted left one byte, Castlevania doesn't 49 | Sync(); 50 | } 51 | 52 | static void AC08Power(void) { 53 | reg = 0; 54 | Sync(); 55 | SetReadHandler(0x6000, 0xFFFF, CartBR); 56 | SetWriteHandler(0x4025, 0x4025, AC08Mirr); 57 | SetWriteHandler(0x8000, 0xFFFF, AC08Write); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void AC08_Init(CartInfo *info) { 65 | info->Power = AC08Power; 66 | GameStateRestore = StateRestore; 67 | AddExState(&StateRegs, ~0, 0, 0); 68 | } 69 | -------------------------------------------------------------------------------- /source/fceultra/boards/bb.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg, chr; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { ®, 1, "REG" }, 28 | { &chr, 1, "CHR" }, 29 | { 0 } 30 | }; 31 | 32 | static void Sync(void) { 33 | setprg8(0x6000, reg & 3); 34 | setprg32(0x8000, ~0); 35 | setchr8(chr & 3); 36 | } 37 | 38 | static DECLFW(UNLBBWrite) { 39 | if ((A & 0x9000) == 0x8000) 40 | reg = chr = V; 41 | else 42 | chr = V & 1; // hacky hacky, ProWres simplified FDS conversion 2-in-1 mapper 43 | Sync(); 44 | } 45 | 46 | static void UNLBBPower(void) { 47 | chr = 0; 48 | reg = ~0; 49 | Sync(); 50 | SetReadHandler(0x6000, 0x7FFF, CartBR); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | SetWriteHandler(0x8000, 0xFFFF, UNLBBWrite); 53 | } 54 | 55 | static void StateRestore(int version) { 56 | Sync(); 57 | } 58 | 59 | void UNLBB_Init(CartInfo *info) { 60 | info->Power = UNLBBPower; 61 | GameStateRestore = StateRestore; 62 | AddExState(&StateRegs, ~0, 0, 0); 63 | } 64 | -------------------------------------------------------------------------------- /source/fceultra/boards/copyfami_mmc3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/fceultra/boards/copyfami_mmc3.cpp -------------------------------------------------------------------------------- /source/fceultra/boards/dream.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 latche; 24 | 25 | static void Sync(void) { 26 | setprg16(0x8000, latche); 27 | setprg16(0xC000, 8); 28 | } 29 | 30 | static DECLFW(DREAMWrite) { 31 | latche = V & 7; 32 | Sync(); 33 | } 34 | 35 | static void DREAMPower(void) { 36 | latche = 0; 37 | Sync(); 38 | setchr8(0); 39 | SetReadHandler(0x8000, 0xFFFF, CartBR); 40 | SetWriteHandler(0x5020, 0x5020, DREAMWrite); 41 | } 42 | 43 | static void Restore(int version) { 44 | Sync(); 45 | } 46 | 47 | void DreamTech01_Init(CartInfo *info) { 48 | GameStateRestore = Restore; 49 | info->Power = DREAMPower; 50 | AddExState(&latche, 1, 0, "LATC"); 51 | } 52 | -------------------------------------------------------------------------------- /source/fceultra/boards/gs-2004.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg, mirr; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { ®, 1, "REGS" }, 27 | { &mirr, 1, "MIRR" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg8r(1, 0x6000, 0); 33 | setprg32(0x8000, reg); 34 | setchr8(0); 35 | } 36 | 37 | static DECLFW(BMCGS2004Write) { 38 | reg = V; 39 | Sync(); 40 | } 41 | 42 | static void BMCGS2004Power(void) { 43 | reg = ~0; 44 | Sync(); 45 | SetReadHandler(0x6000, 0x7FFF, CartBR); 46 | SetReadHandler(0x8000, 0xFFFF, CartBR); 47 | SetWriteHandler(0x8000, 0xFFFF, BMCGS2004Write); 48 | } 49 | 50 | static void BMCGS2004Reset(void) { 51 | reg = ~0; 52 | } 53 | 54 | static void StateRestore(int version) { 55 | Sync(); 56 | } 57 | 58 | void BMCGS2004_Init(CartInfo *info) { 59 | info->Reset = BMCGS2004Reset; 60 | info->Power = BMCGS2004Power; 61 | GameStateRestore = StateRestore; 62 | AddExState(&StateRegs, ~0, 0, 0); 63 | } 64 | -------------------------------------------------------------------------------- /source/fceultra/boards/gs-2013.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 reg, mirr; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { ®, 1, "REGS" }, 27 | { &mirr, 1, "MIRR" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg8r(0, 0x6000, ~0); 33 | setprg32r((reg & 8) >> 3, 0x8000, reg); 34 | setchr8(0); 35 | } 36 | 37 | static DECLFW(BMCGS2013Write) { 38 | reg = V; 39 | Sync(); 40 | } 41 | 42 | static void BMCGS2013Power(void) { 43 | reg = ~0; 44 | Sync(); 45 | SetReadHandler(0x6000, 0x7FFF, CartBR); 46 | SetReadHandler(0x8000, 0xFFFF, CartBR); 47 | SetWriteHandler(0x8000, 0xFFFF, BMCGS2013Write); 48 | } 49 | 50 | static void BMCGS2013Reset(void) { 51 | reg = ~0; 52 | } 53 | 54 | static void StateRestore(int version) { 55 | Sync(); 56 | } 57 | 58 | void BMCGS2013_Init(CartInfo *info) { 59 | info->Reset = BMCGS2013Reset; 60 | info->Power = BMCGS2013Power; 61 | GameStateRestore = StateRestore; 62 | AddExState(&StateRegs, ~0, 0, 0); 63 | } 64 | -------------------------------------------------------------------------------- /source/fceultra/boards/hp898f.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2015 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 regs[2]; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { regs, 2, "REGS" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | uint8 chr = (regs[0] >> 4) & 7; 33 | uint8 prg = (regs[1] >> 3) & 7; 34 | uint8 dec = (regs[1] >> 4) & 4; 35 | setchr8(chr & (~(((regs[0] & 1) << 2) | (regs[0] & 2)))); 36 | setprg16(0x8000,prg & (~dec)); 37 | setprg16(0xC000,prg | dec); 38 | setmirror(regs[1] >> 7); 39 | } 40 | 41 | static DECLFW(HP898FWrite) { 42 | if((A & 0x6000) == 0x6000) { 43 | regs[(A & 4) >> 2] = V; 44 | Sync(); 45 | } 46 | } 47 | 48 | static void HP898FPower(void) { 49 | regs[0] = regs[1] = 0; 50 | Sync(); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | SetWriteHandler(0x6000, 0xFFFF, HP898FWrite); 53 | } 54 | 55 | static void HP898FReset(void) { 56 | regs[0] = regs[1] = 0; 57 | Sync(); 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void BMCHP898F_Init(CartInfo *info) { 65 | info->Reset = HP898FReset; 66 | info->Power = HP898FPower; 67 | GameStateRestore = StateRestore; 68 | AddExState(&StateRegs, ~0, 0, 0); 69 | } 70 | -------------------------------------------------------------------------------- /source/fceultra/boards/inlnsf.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 regs[8]; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { regs, 8, "REGS" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | for (int i=0; i < 8; ++i) 33 | { 34 | setprg4(0x8000 + (0x1000 * i), regs[i]); 35 | } 36 | } 37 | 38 | static DECLFW(M31Write) { 39 | if (A >= 0x5000 && A <= 0x5FFF) 40 | { 41 | regs[A&7] = V; 42 | Sync(); 43 | } 44 | } 45 | 46 | static void M31Power(void) { 47 | setchr8(0); 48 | regs[7] = 0xFF; 49 | Sync(); 50 | SetReadHandler(0x8000, 0xffff, CartBR); 51 | SetWriteHandler(0x5000, 0x5fff, M31Write); 52 | } 53 | 54 | static void StateRestore(int version) { 55 | Sync(); 56 | } 57 | 58 | void Mapper31_Init(CartInfo *info) { 59 | info->Power = M31Power; 60 | GameStateRestore = StateRestore; 61 | AddExState(&StateRegs, ~0, 0, 0); 62 | } 63 | -------------------------------------------------------------------------------- /source/fceultra/boards/karaoke.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | extern uint32 ROM_size; 24 | static uint8 latche; 25 | 26 | static void Sync(void) { 27 | if (latche) { 28 | if (latche & 0x10) 29 | setprg16(0x8000, (latche & 7)); 30 | else 31 | setprg16(0x8000, (latche & 7) | 8); 32 | } else 33 | setprg16(0x8000, 7 + (ROM_size >> 4)); 34 | } 35 | 36 | static DECLFW(M188Write) { 37 | latche = V; 38 | Sync(); 39 | } 40 | 41 | static DECLFR(ExtDev) { 42 | return(3); 43 | } 44 | 45 | static void Power(void) { 46 | latche = 0; 47 | Sync(); 48 | setchr8(0); 49 | setprg16(0xc000, 0x7); 50 | SetReadHandler(0x6000, 0x7FFF, ExtDev); 51 | SetReadHandler(0x8000, 0xFFFF, CartBR); 52 | SetWriteHandler(0x8000, 0xFFFF, M188Write); 53 | } 54 | 55 | static void StateRestore(int version) { 56 | Sync(); 57 | } 58 | 59 | void Mapper188_Init(CartInfo *info) { 60 | info->Power = Power; 61 | GameStateRestore = StateRestore; 62 | AddExState(&latche, 1, 0, "LATC"); 63 | } 64 | -------------------------------------------------------------------------------- /source/fceultra/boards/kof97.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | #include "mmc3.h" 23 | 24 | static DECLFW(UNLKOF97CMDWrite) { 25 | V = (V & 0xD8) | ((V & 0x20) >> 4) | ((V & 4) << 3) | ((V & 2) >> 1) | ((V & 1) << 2); //76143502 26 | if (A == 0x9000) A = 0x8001; 27 | MMC3_CMDWrite(A, V); 28 | } 29 | 30 | static DECLFW(UNLKOF97IRQWrite) { 31 | V = (V & 0xD8) | ((V & 0x20) >> 4) | ((V & 4) << 3) | ((V & 2) >> 1) | ((V & 1) << 2); 32 | if (A == 0xD000) A = 0xC001; 33 | else if (A == 0xF000) A = 0xE001; 34 | MMC3_IRQWrite(A, V); 35 | } 36 | 37 | static void UNLKOF97Power(void) { 38 | GenMMC3Power(); 39 | SetWriteHandler(0x8000, 0xA000, UNLKOF97CMDWrite); 40 | SetWriteHandler(0xC000, 0xF000, UNLKOF97IRQWrite); 41 | } 42 | 43 | void UNLKOF97_Init(CartInfo *info) { 44 | GenMMC3_Init(info, 128, 256, 0, 0); 45 | info->Power = UNLKOF97Power; 46 | } 47 | -------------------------------------------------------------------------------- /source/fceultra/boards/ks7013.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2011 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Just another pirate cart with pirate mapper, instead of original MMC1 21 | * Kaiser Highway Star 22 | * 23 | */ 24 | 25 | #include "mapinc.h" 26 | 27 | static uint8 reg, mirr; 28 | 29 | static SFORMAT StateRegs[] = 30 | { 31 | { ®, 1, "REGS" }, 32 | { &mirr, 1, "MIRR" }, 33 | { 0 } 34 | }; 35 | 36 | static void Sync(void) { 37 | setprg16(0x8000, reg); 38 | setprg16(0xc000, ~0); 39 | setmirror(mirr); 40 | setchr8(0); 41 | } 42 | 43 | static DECLFW(UNLKS7013BLoWrite) { 44 | reg = V; 45 | Sync(); 46 | } 47 | 48 | static DECLFW(UNLKS7013BHiWrite) { 49 | mirr = (V & 1) ^ 1; 50 | Sync(); 51 | } 52 | 53 | static void UNLKS7013BPower(void) { 54 | reg = 0; 55 | mirr = 0; 56 | Sync(); 57 | SetWriteHandler(0x6000, 0x7FFF, UNLKS7013BLoWrite); 58 | SetReadHandler(0x8000, 0xFFFF, CartBR); 59 | SetWriteHandler(0x8000, 0xFFFF, UNLKS7013BHiWrite); 60 | } 61 | 62 | static void UNLKS7013BReset(void) { 63 | reg = 0; 64 | Sync(); 65 | } 66 | 67 | static void StateRestore(int version) { 68 | Sync(); 69 | } 70 | 71 | void UNLKS7013B_Init(CartInfo *info) { 72 | info->Power = UNLKS7013BPower; 73 | info->Reset = UNLKS7013BReset; 74 | 75 | GameStateRestore = StateRestore; 76 | AddExState(&StateRegs, ~0, 0, 0); 77 | } 78 | -------------------------------------------------------------------------------- /source/fceultra/boards/ks7031.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * FDS Conversion 21 | * 22 | */ 23 | 24 | #include "mapinc.h" 25 | 26 | static uint8 reg[4]; 27 | 28 | static SFORMAT StateRegs[] = 29 | { 30 | { reg, 4, "REGS" }, 31 | { 0 } 32 | }; 33 | 34 | static void Sync(void) { 35 | setprg2(0x6000, reg[0]); 36 | setprg2(0x6800, reg[1]); 37 | setprg2(0x7000, reg[2]); 38 | setprg2(0x7800, reg[3]); 39 | 40 | setprg2(0x8000, 15); 41 | setprg2(0x8800, 14); 42 | setprg2(0x9000, 13); 43 | setprg2(0x9800, 12); 44 | setprg2(0xa000, 11); 45 | setprg2(0xa800, 10); 46 | setprg2(0xb000, 9); 47 | setprg2(0xb800, 8); 48 | 49 | setprg2(0xc000, 7); 50 | setprg2(0xc800, 6); 51 | setprg2(0xd000, 5); 52 | setprg2(0xd800, 4); 53 | setprg2(0xe000, 3); 54 | setprg2(0xe800, 2); 55 | setprg2(0xf000, 1); 56 | setprg2(0xf800, 0); 57 | 58 | setchr8(0); 59 | } 60 | 61 | static DECLFW(UNLKS7031Write) { 62 | reg[(A >> 11) & 3] = V; 63 | Sync(); 64 | } 65 | 66 | static void UNLKS7031Power(void) { 67 | Sync(); 68 | SetReadHandler(0x6000, 0xFFFF, CartBR); 69 | SetWriteHandler(0x8000, 0xffff, UNLKS7031Write); 70 | } 71 | 72 | static void StateRestore(int version) { 73 | Sync(); 74 | } 75 | 76 | void UNLKS7031_Init(CartInfo *info) { 77 | info->Power = UNLKS7031Power; 78 | GameStateRestore = StateRestore; 79 | AddExState(&StateRegs, ~0, 0, 0); 80 | } 81 | -------------------------------------------------------------------------------- /source/fceultra/boards/le05.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2011 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * FDS Conversion 21 | * 22 | */ 23 | 24 | #include "mapinc.h" 25 | 26 | static uint8 chr; 27 | static SFORMAT StateRegs[] = 28 | { 29 | { &chr, 1, "CHR" }, 30 | { 0 } 31 | }; 32 | 33 | static void Sync(void) { 34 | setprg2r(0, 0xE000, 0); 35 | setprg2r(0, 0xE800, 0); 36 | setprg2r(0, 0xF000, 0); 37 | setprg2r(0, 0xF800, 0); 38 | 39 | setprg8r(1, 0x6000, 3); 40 | setprg8r(1, 0x8000, 0); 41 | setprg8r(1, 0xA000, 1); 42 | setprg8r(1, 0xC000, 2); 43 | 44 | setchr8(chr & 1); 45 | setmirror(MI_V); 46 | } 47 | 48 | static DECLFW(LE05Write) { 49 | chr = V; 50 | Sync(); 51 | } 52 | 53 | static void LE05Power(void) { 54 | Sync(); 55 | SetReadHandler(0x6000, 0xFFFF, CartBR); 56 | SetWriteHandler(0x8000, 0xFFFF, LE05Write); 57 | } 58 | 59 | void LE05_Init(CartInfo *info) { 60 | info->Power = LE05Power; 61 | AddExState(&StateRegs, ~0, 0, 0); 62 | } 63 | -------------------------------------------------------------------------------- /source/fceultra/boards/lh32.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2007 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * FDS Conversion 21 | * 22 | */ 23 | 24 | #include "mapinc.h" 25 | 26 | static uint8 reg; 27 | static uint8 *WRAM = NULL; 28 | static uint32 WRAMSIZE; 29 | 30 | static SFORMAT StateRegs[] = 31 | { 32 | { ®, 1, "REG" }, 33 | { 0 } 34 | }; 35 | 36 | static void Sync(void) { 37 | setprg8(0x6000, reg); 38 | setprg8(0x8000, ~3); 39 | setprg8(0xa000, ~2); 40 | setprg8r(0x10, 0xc000, 0); 41 | setprg8(0xe000, ~0); 42 | setchr8(0); 43 | } 44 | 45 | static DECLFW(LH32Write) { 46 | reg = V; 47 | Sync(); 48 | } 49 | 50 | static void LH32Power(void) { 51 | Sync(); 52 | SetReadHandler(0x6000, 0xFFFF, CartBR); 53 | SetWriteHandler(0xC000, 0xDFFF, CartBW); 54 | SetWriteHandler(0x6000, 0x6000, LH32Write); 55 | FCEU_CheatAddRAM(WRAMSIZE >> 10, 0x6000, WRAM); 56 | } 57 | 58 | static void LH32Close(void) { 59 | if (WRAM) 60 | FCEU_gfree(WRAM); 61 | WRAM = NULL; 62 | } 63 | 64 | static void StateRestore(int version) { 65 | Sync(); 66 | } 67 | 68 | void LH32_Init(CartInfo *info) { 69 | info->Power = LH32Power; 70 | info->Close = LH32Close; 71 | 72 | WRAMSIZE = 8192; 73 | WRAM = (uint8*)FCEU_gmalloc(WRAMSIZE); 74 | SetupCartPRGMapping(0x10, WRAM, WRAMSIZE, 1); 75 | AddExState(WRAM, WRAMSIZE, 0, "WRAM"); 76 | 77 | GameStateRestore = StateRestore; 78 | AddExState(&StateRegs, ~0, 0, 0); 79 | } 80 | -------------------------------------------------------------------------------- /source/fceultra/boards/malee.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 WRAM[2048]; 24 | 25 | static void MALEEPower(void) { 26 | setprg2r(0x10, 0x7000, 0); 27 | SetReadHandler(0x8000, 0xFFFF, CartBR); 28 | SetReadHandler(0x6000, 0x67FF, CartBR); 29 | SetReadHandler(0x7000, 0x77FF, CartBR); 30 | SetWriteHandler(0x7000, 0x77FF, CartBW); 31 | setprg2r(1, 0x6000, 0); 32 | setprg32(0x8000, 0); 33 | setchr8(0); 34 | } 35 | 36 | void MALEE_Init(CartInfo *info) { 37 | info->Power = MALEEPower; 38 | FCEU_MemoryRand(WRAM,sizeof(WRAM),true); 39 | SetupCartPRGMapping(0x10, WRAM, 2048, 1); 40 | AddExState(WRAM, 2048, 0, "WRAM"); 41 | } 42 | -------------------------------------------------------------------------------- /source/fceultra/boards/mapinc.h: -------------------------------------------------------------------------------- 1 | #include "fceultra/types.h" 2 | #include "utils/memory.h" 3 | #include "fceultra/x6502.h" 4 | #include "fceultra/fceu.h" 5 | #include "fceultra/ppu.h" 6 | #include "fceultra/sound.h" 7 | #include "fceultra/state.h" 8 | #include "fceultra/cart.h" 9 | #include "fceultra/cheat.h" 10 | #include "fceultra/unif.h" 11 | #include 12 | #include 13 | -------------------------------------------------------------------------------- /source/fceultra/boards/mihunche.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2013 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint16 latche; 24 | 25 | static SFORMAT StateRegs[] = 26 | { 27 | { &latche, 2, "LATC" }, 28 | { 0 } 29 | }; 30 | 31 | static void Sync(void) { 32 | setprg32(0x8000, 0); 33 | if(CHRsize[0] == 8192) { 34 | setchr4(0x0000, latche & 1); 35 | setchr4(0x1000, latche & 1); 36 | } else { 37 | setchr8(latche & 1); // actually, my bad, overdumped roms, the real CHR size if 8K 38 | } 39 | setmirror(MI_0 + (latche & 1)); 40 | } 41 | 42 | static DECLFW(UNLCC21Write1) { 43 | latche = A; 44 | Sync(); 45 | } 46 | 47 | static DECLFW(UNLCC21Write2) { 48 | latche = V; 49 | Sync(); 50 | } 51 | 52 | static void UNLCC21Power(void) { 53 | latche = 0; 54 | Sync(); 55 | SetReadHandler(0x8000, 0xFFFF, CartBR); 56 | SetWriteHandler(0x8001, 0xFFFF, UNLCC21Write1); 57 | SetWriteHandler(0x8000, 0x8000, UNLCC21Write2); // another one many-in-1 mapper, there is a lot of similar carts with little different wirings 58 | } 59 | 60 | static void StateRestore(int version) { 61 | Sync(); 62 | } 63 | 64 | void UNLCC21_Init(CartInfo *info) { 65 | info->Power = UNLCC21Power; 66 | GameStateRestore = StateRestore; 67 | AddExState(&StateRegs, ~0, 0, 0); 68 | } 69 | -------------------------------------------------------------------------------- /source/fceultra/boards/mmc3.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/fceultra/boards/mmc3.cpp -------------------------------------------------------------------------------- /source/fceultra/boards/mmc3.h: -------------------------------------------------------------------------------- 1 | extern uint8 MMC3_cmd; 2 | extern uint8 mmc3opts; 3 | extern uint8 A000B; 4 | extern uint8 A001B; 5 | extern uint8 EXPREGS[8]; 6 | extern uint8 DRegBuf[8]; 7 | 8 | #undef IRQCount 9 | #undef IRQLatch 10 | #undef IRQa 11 | extern uint8 IRQCount,IRQLatch,IRQa; 12 | extern uint8 IRQReload; 13 | 14 | extern void (*pwrap)(uint32 A, uint8 V); 15 | extern void (*cwrap)(uint32 A, uint8 V); 16 | extern void (*mwrap)(uint8 V); 17 | 18 | void GenMMC3Power(void); 19 | void GenMMC3Restore(int version); 20 | void MMC3RegReset(void); 21 | void FixMMC3PRG(int V); 22 | void FixMMC3CHR(int V); 23 | DECLFW(MMC3_CMDWrite); 24 | DECLFW(MMC3_IRQWrite); 25 | 26 | void GenMMC3_Init(CartInfo *info, int prg, int chr, int wram, int battery); 27 | -------------------------------------------------------------------------------- /source/fceultra/boards/novel.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 latch; 24 | 25 | static void DoNovel(void) { 26 | setprg32(0x8000, latch & 3); 27 | setchr8(latch & 7); 28 | } 29 | 30 | static DECLFW(NovelWrite) { 31 | latch = A & 0xFF; 32 | DoNovel(); 33 | } 34 | 35 | static void NovelReset(void) { 36 | SetWriteHandler(0x8000, 0xFFFF, NovelWrite); 37 | SetReadHandler(0x8000, 0xFFFF, CartBR); 38 | setprg32(0x8000, 0); 39 | setchr8(0); 40 | } 41 | 42 | static void NovelRestore(int version) { 43 | DoNovel(); 44 | } 45 | 46 | void Novel_Init(CartInfo *info) { 47 | AddExState(&latch, 1, 0, "L1"); 48 | info->Power = NovelReset; 49 | GameStateRestore = NovelRestore; 50 | } 51 | -------------------------------------------------------------------------------- /source/fceultra/boards/onebus.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/fceultra/boards/onebus.cpp -------------------------------------------------------------------------------- /source/fceultra/boards/rt-01.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2016 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * Test Ver. 1.01 Dlya Proverki TV Pristavok (RT-01, by SS aka Snake) 21 | * A simple board with 16K PRG ROM + 2K CHR ROM with no mapper, hardwired mirroring 22 | * PRG EPROM has copy protected areas with "weak bits", which is tested at some 23 | * points of the program. Trying to simalate "weak bits" behaviour 24 | * 25 | */ 26 | 27 | #include "mapinc.h" 28 | 29 | extern u64 xoroshiro128plus_next(); // deterministic random 30 | 31 | static DECLFR(UNLRT01Read) { 32 | // u16 i, prot_areas[2][2] = { 33 | // { 0x8E80, 0x8EFF }, 34 | // { 0xFE80, 0xFEFF }, 35 | // }; 36 | if(((A >= 0xCE80) && (A < 0xCF00)) || 37 | ((A >= 0xFE80) && (A < 0xFF00))) { 38 | return 0xF2 | (xoroshiro128plus_next() & 0x0D); 39 | } else 40 | return CartBR(A); 41 | } 42 | 43 | static void UNLRT01Power(void) { 44 | setprg16(0x8000, 0); 45 | setprg16(0xC000, 0); 46 | setchr2(0x0000,0); 47 | setchr2(0x0800,0); 48 | setchr2(0x1000,0); 49 | setchr2(0x1800,0); 50 | SetReadHandler(0x8000, 0xFFFF, UNLRT01Read); 51 | } 52 | 53 | void UNLRT01_Init(CartInfo *info) { 54 | info->Power = UNLRT01Power; 55 | } 56 | -------------------------------------------------------------------------------- /source/fceultra/boards/sa-9602b.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | #include "mmc3.h" 23 | 24 | static void SA9602BPW(uint32 A, uint8 V) { 25 | setprg8r(EXPREGS[1], A, V & 0x3F); 26 | if (MMC3_cmd & 0x40) 27 | setprg8r(0, 0x8000, ~(1)); 28 | else 29 | setprg8r(0, 0xc000, ~(1)); 30 | setprg8r(0, 0xe000, ~(0)); 31 | } 32 | 33 | static DECLFW(SA9602BWrite) { 34 | switch (A & 0xe001) { 35 | case 0x8000: EXPREGS[0] = V; break; 36 | case 0x8001: 37 | if ((EXPREGS[0] & 7) < 6) { 38 | EXPREGS[1] = V >> 6; 39 | FixMMC3PRG(MMC3_cmd); 40 | } 41 | break; 42 | } 43 | MMC3_CMDWrite(A, V); 44 | } 45 | 46 | static void SA9602BPower(void) { 47 | EXPREGS[0] = EXPREGS[1] = 0; 48 | GenMMC3Power(); 49 | SetReadHandler(0x8000, 0xFFFF, CartBR); 50 | SetWriteHandler(0x8000, 0xBFFF, SA9602BWrite); 51 | } 52 | 53 | void SA9602B_Init(CartInfo *info) { 54 | GenMMC3_Init(info, 512, 0, 0, 0); 55 | pwrap = SA9602BPW; 56 | mmc3opts |= 2; 57 | info->SaveGame[0] = UNIFchrrama; 58 | info->SaveGameLen[0] = 32 * 1024; 59 | info->Power = SA9602BPower; 60 | AddExState(EXPREGS, 2, 0, "EXPR"); 61 | } 62 | -------------------------------------------------------------------------------- /source/fceultra/boards/t-262.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2006 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "mapinc.h" 22 | 23 | static uint8 bank, base, lock, mirr, mode; 24 | static SFORMAT StateRegs[] = 25 | { 26 | { &bank, 1, "BANK" }, 27 | { &base, 1, "BASE" }, 28 | { &lock, 1, "LOCK" }, 29 | { &mirr, 1, "MIRR" }, 30 | { &mode, 1, "MODE" }, 31 | { 0 } 32 | }; 33 | 34 | static void Sync(void) { 35 | setchr8(0); 36 | setprg16(0x8000, base | bank); 37 | setprg16(0xC000, base | (mode ? bank : 7)); 38 | setmirror(mirr); 39 | } 40 | 41 | static DECLFW(BMCT262Write) { 42 | if (!lock) { 43 | base = ((A & 0x60) >> 2) | ((A & 0x100) >> 3); 44 | mode = A & 0x80; 45 | mirr = ((A & 2) >> 1) ^ 1; 46 | lock = (A & 0x2000) >> 13; 47 | } 48 | bank = V & 7; 49 | Sync(); 50 | } 51 | 52 | static void BMCT262Power(void) { 53 | lock = bank = base = mode = 0; 54 | Sync(); 55 | SetWriteHandler(0x8000, 0xFFFF, BMCT262Write); 56 | SetReadHandler(0x8000, 0xFFFF, CartBR); 57 | } 58 | 59 | static void BMCT262Reset(void) { 60 | lock = bank = base = mode = 0; 61 | Sync(); 62 | } 63 | 64 | static void BMCT262Restore(int version) { 65 | Sync(); 66 | } 67 | 68 | void BMCT262_Init(CartInfo *info) { 69 | info->Power = BMCT262Power; 70 | info->Reset = BMCT262Reset; 71 | GameStateRestore = BMCT262Restore; 72 | AddExState(&StateRegs, ~0, 0, 0); 73 | } 74 | -------------------------------------------------------------------------------- /source/fceultra/boards/vrc1.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2012 CaH4e3 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | * VRC-1 21 | * 22 | */ 23 | 24 | #include "mapinc.h" 25 | 26 | static uint8 preg[3], creg[2], mode; 27 | static SFORMAT StateRegs[] = 28 | { 29 | { &mode, 1, "MODE" }, 30 | { creg, 2, "CREG" }, 31 | { preg, 3, "PREG" }, 32 | { 0 } 33 | }; 34 | 35 | static void Sync(void) { 36 | setprg8(0x8000, preg[0]); 37 | setprg8(0xA000, preg[1]); 38 | setprg8(0xC000, preg[2]); 39 | setprg8(0xE000, ~0); 40 | setchr4(0x0000, creg[0] | ((mode & 2) << 3)); 41 | setchr4(0x1000, creg[1] | ((mode & 4) << 2)); 42 | setmirror((mode & 1) ^ 1); 43 | } 44 | 45 | static DECLFW(M75Write) { 46 | switch (A & 0xF000) { 47 | case 0x8000: preg[0] = V; Sync(); break; 48 | case 0x9000: mode = V; Sync(); break; 49 | case 0xA000: preg[1] = V; Sync(); break; 50 | case 0xC000: preg[2] = V; Sync(); break; 51 | case 0xE000: creg[0] = V & 0xF; Sync(); break; 52 | case 0xF000: creg[1] = V & 0xF; Sync(); break; 53 | } 54 | } 55 | 56 | static void M75Power(void) { 57 | Sync(); 58 | SetWriteHandler(0x8000, 0xFFFF, M75Write); 59 | SetReadHandler(0x8000, 0xFFFF, CartBR); 60 | } 61 | 62 | static void StateRestore(int version) { 63 | Sync(); 64 | } 65 | 66 | void Mapper75_Init(CartInfo *info) { 67 | info->Power = M75Power; 68 | AddExState(&StateRegs, ~0, 0, 0); 69 | GameStateRestore = StateRestore; 70 | } 71 | -------------------------------------------------------------------------------- /source/fceultra/cheat.h: -------------------------------------------------------------------------------- 1 | void FCEU_CheatResetRAM(void); 2 | void FCEU_CheatAddRAM(int s, uint32 A, uint8 *p); 3 | 4 | void FCEU_LoadGameCheats(FILE *override); 5 | void FCEU_FlushGameCheats(FILE *override, int nosave); 6 | void FCEU_ApplyPeriodicCheats(void); 7 | void FCEU_PowerCheats(void); 8 | 9 | int FCEU_CheatGetByte(uint32 A); 10 | void FCEU_CheatSetByte(uint32 A, uint8 V); 11 | 12 | extern int savecheats; -------------------------------------------------------------------------------- /source/fceultra/conddebug.h: -------------------------------------------------------------------------------- 1 | /* FCEUXD SP - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2005 Sebastian Porst 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #ifndef CONDDEBUG_H 22 | #define CONDDEBUG_H 23 | 24 | #define TYPE_NO 0 25 | #define TYPE_REG 1 26 | #define TYPE_FLAG 2 27 | #define TYPE_NUM 3 28 | #define TYPE_ADDR 4 29 | #define TYPE_PC_BANK 5 30 | #define TYPE_DATA_BANK 6 31 | #define TYPE_VALUE_READ 7 32 | #define TYPE_VALUE_WRITE 8 33 | 34 | #define OP_NO 0 35 | #define OP_EQ 1 36 | #define OP_NE 2 37 | #define OP_GE 3 38 | #define OP_LE 4 39 | #define OP_G 5 40 | #define OP_L 6 41 | #define OP_PLUS 7 42 | #define OP_MINUS 8 43 | #define OP_MULT 9 44 | #define OP_DIV 10 45 | #define OP_OR 11 46 | #define OP_AND 12 47 | 48 | extern uint16 debugLastAddress; 49 | extern uint8 debugLastOpcode; 50 | 51 | //mbg merge 7/18/06 turned into sane c++ 52 | struct Condition 53 | { 54 | Condition* lhs; 55 | Condition* rhs; 56 | 57 | unsigned int type1; 58 | unsigned int value1; 59 | 60 | unsigned int op; 61 | 62 | unsigned int type2; 63 | unsigned int value2; 64 | }; 65 | 66 | void freeTree(Condition* c); 67 | Condition* generateCondition(const char* str); 68 | 69 | #endif 70 | -------------------------------------------------------------------------------- /source/fceultra/config.cpp: -------------------------------------------------------------------------------- 1 | /// \file 2 | /// \brief Contains methods related to the build configuration 3 | 4 | #include "types.h" 5 | #include "version.h" 6 | #include "fceu.h" 7 | #include "driver.h" 8 | #include "utils/memory.h" 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | static char *aboutString = 0; 15 | 16 | // returns a string suitable for use in an aboutbox 17 | char *FCEUI_GetAboutString() { 18 | const char *aboutTemplate = 19 | FCEU_NAME_AND_VERSION "\n\n" 20 | "Administrators:\n" 21 | "zeromus, punkrockguy318 (Lukas Sabota), feos\n" 22 | "\n" 23 | "Current Contributors:\n" 24 | "CaH4e3, rainwarrior\n" 25 | "\n" 26 | "Past Contributors:\n" 27 | "xhainingx, gocha, AnS\n" 28 | "\n" 29 | "FCEUX 2.0:\n" 30 | "mz, nitsujrehtona, SP, Ugly Joe,\n" 31 | "Plombo, qeed, QFox, Shinydoofy\n" 32 | "ugetab, Acmlm, DWEdit\n" 33 | "\n" 34 | "Previous versions:\n" 35 | "FCE - Bero\n" 36 | "FCEU - Xodnizel\n" 37 | "FCEU XD - Bbitmaster & Parasyte\n" 38 | "FCEU XD SP - Sebastian Porst\n" 39 | "FCEU MM - CaH4e3\n" 40 | "FCEU TAS - blip & nitsuja\n" 41 | "FCEU TAS+ - Luke Gustafson\n" 42 | "\n" 43 | "FCEUX is dedicated to the fallen heroes\n" 44 | "of NES emulation. In Memoriam --\n" 45 | "ugetab\n" 46 | "\n" 47 | __TIME__ " " __DATE__ "\n"; 48 | 49 | if(aboutString) return aboutString; 50 | 51 | const char *compilerString = FCEUD_GetCompilerString(); 52 | 53 | //allocate the string and concatenate the template with the compiler string 54 | if (!(aboutString = (char*)FCEU_dmalloc(strlen(aboutTemplate) + strlen(compilerString) + 1))) 55 | return NULL; 56 | 57 | sprintf(aboutString,"%s%s",aboutTemplate,compilerString); 58 | return aboutString; 59 | } 60 | -------------------------------------------------------------------------------- /source/fceultra/drawing.h: -------------------------------------------------------------------------------- 1 | void DrawTextLineBG(uint8 *dest); 2 | void DrawMessage(bool beforeMovie); 3 | void FCEU_DrawRecordingStatus(uint8* XBuf); 4 | void FCEU_DrawNumberRow(uint8 *XBuf, int *nstatus, int cur); 5 | void DrawTextTrans(uint8 *dest, uint32 width, uint8 *textmsg, uint8 fgcolor); 6 | void DrawTextTransWH(uint8 *dest, int width, uint8 *textmsg, uint8 fgcolor, int max_w, int max_h, int border); 7 | -------------------------------------------------------------------------------- /source/fceultra/emufile_types.h: -------------------------------------------------------------------------------- 1 | #ifndef EMUFILE_TYPES_H 2 | #define EMUFILE_TYPES_H 3 | 4 | #include "types.h" 5 | 6 | typedef uint8 u8; 7 | typedef uint16 u16; 8 | typedef uint32 u32; 9 | typedef uint64 u64; 10 | typedef int8 s8; 11 | typedef int16 s16; 12 | typedef int32 s32; 13 | typedef int64 s64; 14 | 15 | 16 | #endif //EMUFILE_TYPES_H 17 | -------------------------------------------------------------------------------- /source/fceultra/fds.h: -------------------------------------------------------------------------------- 1 | extern bool isFDS; 2 | void FDSSoundReset(void); 3 | 4 | void FCEU_FDSInsert(void); 5 | //void FCEU_FDSEject(void); 6 | void FCEU_FDSSelect(void); 7 | -------------------------------------------------------------------------------- /source/fceultra/filter.h: -------------------------------------------------------------------------------- 1 | int32 NeoFilterSound(int32 *in, int32 *out, uint32 inlen, int32 *leftover); 2 | void MakeFilters(int32 rate); 3 | void SexyFilter(int32 *in, int32 *out, int32 count); 4 | -------------------------------------------------------------------------------- /source/fceultra/fir/Makefile: -------------------------------------------------------------------------------- 1 | CC = gcc 2 | %.h: %.coef 3 | cat $< | ./toh > $@ || true 4 | 5 | all: floogie c44100ntsc.h c48000ntsc.h c96000ntsc.h c44100pal.h c48000pal.h c96000pal.h 6 | 7 | #c44100ntsc.h: c44100ntsc.coef 8 | #c48000ntsc.h: c48000ntsc.coef 9 | #c96000ntsc.h: c96000ntsc.coef 10 | #c44100pal.h: c44100pal.coef 11 | #c48000pal.h: c48000pal.coef 12 | #c96000pal.h: c96000pal.coef 13 | 14 | floogie: toh.o 15 | gcc -o toh toh.o 16 | -------------------------------------------------------------------------------- /source/fceultra/fir/README: -------------------------------------------------------------------------------- 1 | appears to be related to http://gmeteor.sourceforge.net/index.html -------------------------------------------------------------------------------- /source/fceultra/fir/c44100ntsc.scm: -------------------------------------------------------------------------------- 1 | (title "44100 NTSC") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1789772.727272727272) 8 | (limit-= (band 0 15000) 1) 9 | (limit-= (band 22050 894886.363636) 0 .5) 10 | (output-file "c44100ntsc.coef") 11 | (plot-file "c44100ntsc.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/c44100pal.scm: -------------------------------------------------------------------------------- 1 | (title "44100 PAL") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1662607.125) 8 | (limit-= (band 0 15500) 1) 9 | (limit-= (band 22050 831303.5625) 0 .5) 10 | (output-file "c44100pal.coef") 11 | (plot-file "c44100pal.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/c48000ntsc.scm: -------------------------------------------------------------------------------- 1 | (title "48000 NTSC") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1789772.727272727272) 8 | (limit-= (band 0 17000) 1) 9 | (limit-= (band 24000 894886.363636) 0 .5) 10 | (output-file "c48000ntsc.coef") 11 | (plot-file "c48000ntsc.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/c48000pal.scm: -------------------------------------------------------------------------------- 1 | (title "48000 PAL") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1662607.125) 8 | (limit-= (band 0 17500) 1) 9 | (limit-= (band 24000 831303.5625) 0 .5) 10 | (output-file "c48000pal.coef") 11 | (plot-file "c48000pal.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/c96000ntsc.scm: -------------------------------------------------------------------------------- 1 | (title "96000 NTSC") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1789772.727272727272) 8 | (limit-= (band 0 36850) 1) 9 | (limit-= (band 48000 894886.363636) 0 .5) 10 | (output-file "c96000ntsc.coef") 11 | (plot-file "c96000ntsc.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/c96000pal.scm: -------------------------------------------------------------------------------- 1 | (title "96000 PAL") 2 | 3 | (verbose #t) 4 | 5 | (cosine-symmetry) 6 | (filter-length 1024) 7 | (sampling-frequency 1662607.125) 8 | (limit-= (band 0 33400) 1) 9 | (limit-= (band 48000 831303.5625) 0 .5) 10 | (output-file "c96000pal.coef") 11 | (plot-file "c96000pal.plot") 12 | (go) 13 | -------------------------------------------------------------------------------- /source/fceultra/fir/toh.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #define MAX 512 4 | 5 | main() 6 | { 7 | char buf[256]; 8 | int count=0; 9 | 10 | while(fgets(buf,256,stdin)>0) 11 | { 12 | double p; 13 | 14 | if(sscanf(buf,"%lf",&p)==1) 15 | { 16 | p*=65536*16; 17 | printf("%ld,\n",(long)p); 18 | count++; 19 | if(count==MAX) break; 20 | } 21 | 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /source/fceultra/input/bworld.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static int seq,ptr,bit,cnt,have; 25 | static uint8 bdata[32]; 26 | 27 | 28 | static uint8 Read(int w, uint8 ret) 29 | { 30 | if(w && have) 31 | { 32 | switch(seq) 33 | { 34 | case 0: seq++; ptr=0; ret|=0x4; break; 35 | case 1: seq++; bit=bdata[ptr]; cnt=0; ret|=0x4; break; 36 | case 2: ret|=((bit&0x01)^0x01)<<2; bit>>=1; if(++cnt > 7) seq++; 37 | break; 38 | case 3: if(++ptr > 19) 39 | { 40 | seq=-1; 41 | have=0; 42 | } 43 | else 44 | seq=1; 45 | default: break; 46 | } 47 | } 48 | return(ret); 49 | } 50 | 51 | static void Write(uint8 V) 52 | { 53 | //printf("%02x\n",V); 54 | } 55 | 56 | static void Update(void *data, int arg) 57 | { 58 | if(*(uint8 *)data) 59 | { 60 | *(uint8 *)data=0; 61 | seq=ptr=0; 62 | have=1; 63 | strcpy((char*) bdata, (char*) data + 1); // mbg merge 7/17/06 64 | strcpy((char*) bdata + 13, "SUNSOFT"); // mbg merge 0/17/06 65 | } 66 | } 67 | 68 | static INPUTCFC BarcodeWorld={Read,Write,0,Update,0,0}; 69 | 70 | INPUTCFC *FCEU_InitBarcodeWorld(void) 71 | { 72 | return(&BarcodeWorld); 73 | } 74 | 75 | -------------------------------------------------------------------------------- /source/fceultra/input/cursor.cpp: -------------------------------------------------------------------------------- 1 | #include "share.h" 2 | 3 | static uint8 GunSight[]={ 4 | 0,0,0,0,0,0,1,0,0,0,0,0,0, 5 | 0,0,0,0,0,0,2,0,0,0,0,0,0, 6 | 0,0,0,0,0,0,1,0,0,0,0,0,0, 7 | 0,0,0,0,0,0,2,0,0,0,0,0,0, 8 | 0,0,0,0,0,0,0,0,0,0,0,0,0, 9 | 0,0,0,0,0,0,3,0,0,0,0,0,0, 10 | 1,2,1,2,0,3,3,3,0,2,1,2,1, 11 | 0,0,0,0,0,0,3,0,0,0,0,0,0, 12 | 0,0,0,0,0,0,0,0,0,0,0,0,0, 13 | 0,0,0,0,0,0,2,0,0,0,0,0,0, 14 | 0,0,0,0,0,0,1,0,0,0,0,0,0, 15 | 0,0,0,0,0,0,2,0,0,0,0,0,0, 16 | 0,0,0,0,0,0,1,0,0,0,0,0,0, 17 | }; 18 | static uint8 FCEUcursor[11*19]= 19 | { 20 | 1,0,0,0,0,0,0,0,0,0,0, 21 | 1,1,0,0,0,0,0,0,0,0,0, 22 | 1,2,1,0,0,0,0,0,0,0,0, 23 | 1,2,2,1,0,0,0,0,0,0,0, 24 | 1,2,2,2,1,0,0,0,0,0,0, 25 | 1,2,2,2,2,1,0,0,0,0,0, 26 | 1,2,2,2,2,2,1,0,0,0,0, 27 | 1,2,2,2,2,2,2,1,0,0,0, 28 | 1,2,2,2,2,2,2,2,1,0,0, 29 | 1,2,2,2,2,2,2,2,2,1,0, 30 | 1,2,2,2,2,2,1,1,1,1,1, 31 | 1,2,2,1,2,2,1,0,0,0,0, 32 | 1,2,1,0,1,2,2,1,0,0,0, 33 | 1,1,0,0,1,2,2,1,0,0,0, 34 | 1,0,0,0,0,1,2,2,1,0,0, 35 | 0,0,0,0,0,1,2,2,1,0,0, 36 | 0,0,0,0,0,0,1,2,2,1,0, 37 | 0,0,0,0,0,0,1,2,2,1,0, 38 | 0,0,0,0,0,0,0,1,1,0,0, 39 | }; 40 | 41 | void FCEU_DrawGunSight(uint8 *buf, int xc, int yc) 42 | { 43 | int x,y; 44 | int c,d; 45 | 46 | for(y=0;y<13;y++) 47 | for(x=0;x<13;x++) 48 | { 49 | uint8 a; 50 | a=GunSight[y*13+x]; 51 | if(a) 52 | { 53 | c=(yc+y-6); 54 | d=(xc+x-6); 55 | if(c>=0 && d>=0 && d<256 && c<240) 56 | { 57 | if(a==3) 58 | buf[c*256+d]=0xBF-(buf[c*256+d]&0x3F); 59 | else 60 | buf[c*256+d]=a-1; 61 | } 62 | } 63 | } 64 | } 65 | 66 | 67 | void FCEU_DrawCursor(uint8 *buf, int xc, int yc) 68 | { 69 | int x,y; 70 | int c,d; 71 | 72 | if(xc<256 && yc<240) 73 | for(y=0;y<19;y++) 74 | for(x=0;x<11;x++) 75 | { 76 | uint8 a; 77 | a=FCEUcursor[y*11+x]; 78 | if(a) 79 | { 80 | c=(yc+y); 81 | d=(xc+x); 82 | if(d<256 && c<240) 83 | buf[c*256+d]=a+127; 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /source/fceultra/input/famicom3d.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * This file handles the Stereoscopic 3D shutter-glasses of Famicom 3D System 3 | * They worked the way a modern 3D TV works, but at a much lower refresh rate 4 | * All we do here is set a global variable to the state of the OUT1 pin 5 | ****************************************************************************/ 6 | 7 | /* FCE Ultra - NES/Famicom Emulator 8 | * 9 | * Copyright notice for this file: 10 | * Copyright (C) 2010 Carl Kenner 11 | * 12 | * This program is free software; you can redistribute it and/or modify 13 | * it under the terms of the GNU General Public License as published by 14 | * the Free Software Foundation; either version 2 of the License, or 15 | * (at your option) any later version. 16 | * 17 | * This program is distributed in the hope that it will be useful, 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | * GNU General Public License for more details. 21 | * 22 | * You should have received a copy of the GNU General Public License 23 | * along with this program; if not, write to the Free Software 24 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 | */ 26 | 27 | #include "share.h" 28 | 29 | uint8 shutter_3d; 30 | 31 | static void Write(uint8 V) 32 | { 33 | shutter_3d = (V >> 1) & 1; 34 | } 35 | 36 | static INPUTCFC Famicom3D={0,Write,0,0,0,0}; 37 | 38 | INPUTCFC *FCEU_InitFamicom3D(void) 39 | { 40 | return(&Famicom3D); 41 | } 42 | 43 | -------------------------------------------------------------------------------- /source/fceultra/input/fkb.h: -------------------------------------------------------------------------------- 1 | #define FKB_F1 0x01 2 | #define FKB_F2 0x02 3 | #define FKB_F3 0x03 4 | #define FKB_F4 0x04 5 | #define FKB_F5 0x05 6 | #define FKB_F6 0x06 7 | #define FKB_F7 0x07 8 | #define FKB_F8 0x08 9 | #define FKB_1 0x09 10 | #define FKB_2 0x0A 11 | #define FKB_3 0x0B 12 | #define FKB_4 0x0C 13 | #define FKB_5 0x0D 14 | #define FKB_6 0x0E 15 | #define FKB_7 0x0F 16 | #define FKB_8 0x10 17 | #define FKB_9 0x11 18 | #define FKB_0 0x12 19 | #define FKB_MINUS 0x13 20 | #define FKB_CARET 0x14 21 | #define FKB_BACKSLASH 0x15 22 | #define FKB_STOP 0x16 23 | #define FKB_ESCAPE 0x17 24 | #define FKB_Q 0x18 25 | #define FKB_W 0x19 26 | #define FKB_E 0x1A 27 | #define FKB_R 0x1B 28 | #define FKB_T 0x1C 29 | #define FKB_Y 0x1D 30 | #define FKB_U 0x1E 31 | #define FKB_I 0x1F 32 | #define FKB_O 0x20 33 | #define FKB_P 0x21 34 | #define FKB_AT 0x22 35 | #define FKB_BRACKETLEFT 0x23 36 | #define FKB_RETURN 0x24 37 | #define FKB_CONTROL 0x25 38 | #define FKB_A 0x26 39 | #define FKB_S 0x27 40 | #define FKB_D 0x28 41 | #define FKB_F 0x29 42 | #define FKB_G 0x2A 43 | #define FKB_H 0x2B 44 | #define FKB_J 0x2C 45 | #define FKB_K 0x2D 46 | #define FKB_L 0x2E 47 | #define FKB_SEMICOLON 0x2F 48 | #define FKB_COLON 0x30 49 | #define FKB_BRACKETRIGHT 0x31 50 | #define FKB_KANA 0x32 51 | #define FKB_LEFTSHIFT 0x33 52 | #define FKB_Z 0x34 53 | #define FKB_X 0x35 54 | #define FKB_C 0x36 55 | #define FKB_V 0x37 56 | #define FKB_B 0x38 57 | #define FKB_N 0x39 58 | #define FKB_M 0x3A 59 | #define FKB_COMMA 0x3B 60 | #define FKB_PERIOD 0x3C 61 | #define FKB_SLASH 0x3D 62 | #define FKB_UNDERSCORE 0x3E 63 | #define FKB_RIGHTSHIFT 0x3F 64 | #define FKB_GRAPH 0x40 65 | #define FKB_SPACE 0x41 66 | #define FKB_CLEAR 0x42 67 | #define FKB_INSERT 0x43 68 | #define FKB_DELETE 0x44 69 | #define FKB_UP 0x45 70 | #define FKB_LEFT 0x46 71 | #define FKB_RIGHT 0x47 72 | #define FKB_DOWN 0x48 73 | -------------------------------------------------------------------------------- /source/fceultra/input/ftrainer.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static uint32 FTVal,FTValR; 25 | static char side; 26 | 27 | static uint8 FT_Read(int w, uint8 ret) 28 | { 29 | if(w) 30 | { 31 | ret|=FTValR; 32 | } 33 | return(ret); 34 | } 35 | 36 | static void FT_Write(uint8 V) 37 | { 38 | FTValR=0; 39 | 40 | //printf("%08x\n",FTVal); 41 | if(!(V&0x1)) 42 | FTValR=(FTVal>>8); 43 | else if(!(V&0x2)) 44 | FTValR=(FTVal>>4); 45 | else if(!(V&0x4)) 46 | FTValR=FTVal; 47 | 48 | FTValR=(~FTValR)&0xF; 49 | if(side=='B') 50 | FTValR=((FTValR&0x8)>>3) | ((FTValR&0x4)>>1) | ((FTValR&0x2)<<1) | ((FTValR&0x1)<<3); 51 | FTValR<<=1; 52 | } 53 | 54 | static void FT_Update(void *data, int arg) 55 | { 56 | FTVal=*(uint32 *)data; 57 | } 58 | 59 | static INPUTCFC FamilyTrainer={FT_Read,FT_Write,0,FT_Update,0,0}; 60 | 61 | INPUTCFC *FCEU_InitFamilyTrainerA(void) 62 | { 63 | side='A'; 64 | FTVal=FTValR=0; 65 | return(&FamilyTrainer); 66 | } 67 | 68 | INPUTCFC *FCEU_InitFamilyTrainerB(void) 69 | { 70 | side='B'; 71 | FTVal=FTValR=0; 72 | return(&FamilyTrainer); 73 | } 74 | 75 | -------------------------------------------------------------------------------- /source/fceultra/input/hypershot.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static uint8 HSVal,HSValR; 25 | 26 | 27 | static uint8 HS_Read(int w, uint8 ret) 28 | { 29 | if(w) ret|=HSValR; 30 | 31 | return(ret); 32 | } 33 | 34 | static void HS_Strobe(void) 35 | { 36 | HSValR=HSVal<<1; 37 | } 38 | 39 | static void HS_Update(void *data, int arg) 40 | { 41 | HSVal=*(uint8*)data; 42 | } 43 | 44 | static INPUTCFC HyperShot={HS_Read,0,HS_Strobe,HS_Update,0,0}; 45 | 46 | INPUTCFC *FCEU_InitHS(void) 47 | { 48 | HSVal=HSValR=0; 49 | return(&HyperShot); 50 | } 51 | -------------------------------------------------------------------------------- /source/fceultra/input/mahjong.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static uint32 MReal,MRet; 25 | 26 | static uint8 MJ_Read(int w, uint8 ret) 27 | { 28 | if(w) 29 | { 30 | // ret|=(MRet&1)<<1; 31 | ret|=((MRet&0x80)>>6)&2; 32 | // MRet>>=1; 33 | if(!fceuindbg) 34 | MRet<<=1; 35 | } 36 | return(ret); 37 | } 38 | 39 | static void MJ_Write(uint8 v) 40 | { 41 | /* 1: I-D7, J-D6, K-D5, L-D4, M-D3, Big Red-D2 42 | 2: A-D7, B-D6, C-D5, D-D4, E-D3, F-D2, G-D1, H-D0 43 | 3: Sel-D6, Start-D7, D5, D4, D3, D2, D1 44 | */ 45 | MRet=0; 46 | 47 | v>>=1; 48 | v&=3; 49 | 50 | if(v==3) 51 | { 52 | MRet=(MReal>>14)&0x7F; 53 | //MRet=((MRet&0x1F) |((MRet&0x40)>>1)|((MRet&0x20)<<1)) <<1; //(MReal>>13)&0x7F; 54 | } 55 | else if(v==2) 56 | { 57 | MRet=MReal&0xFF; 58 | } 59 | else if(v==1) 60 | { 61 | MRet=(MReal>>8)&0x3F; 62 | } 63 | // HSValR=HSVal<<1; 64 | } 65 | 66 | static void MJ_Update(void *data, int arg) 67 | { 68 | MReal=*(uint32*)data; 69 | //printf("%08x\n",MReal>>13); 70 | //HSVal=*(uint8*)data; 71 | } 72 | 73 | static INPUTCFC Mahjong={MJ_Read,MJ_Write,0,MJ_Update,0,0}; 74 | 75 | INPUTCFC *FCEU_InitMahjong(void) 76 | { 77 | MReal=MRet=0; 78 | return(&Mahjong); 79 | } 80 | -------------------------------------------------------------------------------- /source/fceultra/input/quiz.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static uint8 QZVal,QZValR; 25 | static uint8 FunkyMode; 26 | 27 | static uint8 QZ_Read(int w, uint8 ret) 28 | { 29 | if(w) 30 | { 31 | //if(X.PC==0xdc7d) return(0xFF); 32 | //printf("Blah: %04x\n",X.PC); 33 | //FCEUI_DumpMem("dmp2",0xc000,0xffff); 34 | 35 | ret|=(QZValR&0x7)<<2; 36 | QZValR=QZValR>>3; 37 | 38 | if(FunkyMode) 39 | { 40 | //ret=0x14; 41 | //puts("Funky"); 42 | QZValR|=0x28; 43 | } 44 | else 45 | { 46 | QZValR|=0x38; 47 | } 48 | } 49 | return(ret); 50 | } 51 | 52 | static void QZ_Strobe(void) 53 | { 54 | QZValR=QZVal; 55 | //puts("Strobe"); 56 | } 57 | 58 | static void QZ_Write(uint8 V) 59 | { 60 | //printf("Wr: %02x\n",V); 61 | FunkyMode=V&4; 62 | } 63 | 64 | static void QZ_Update(void *data, int arg) 65 | { 66 | QZVal=*(uint8 *)data; 67 | } 68 | 69 | static INPUTCFC QuizKing={QZ_Read,QZ_Write,QZ_Strobe,QZ_Update,0,0}; 70 | 71 | INPUTCFC *FCEU_InitQuizKing(void) 72 | { 73 | QZVal=QZValR=0; 74 | return(&QuizKing); 75 | } 76 | -------------------------------------------------------------------------------- /source/fceultra/input/share.h: -------------------------------------------------------------------------------- 1 | #include "../types.h" 2 | #include "../input.h" 3 | #include "../fceu.h" 4 | #include "../ppu.h" 5 | #include "../x6502.h" 6 | #include "../palette.h" 7 | 8 | void FCEU_DrawCursor(uint8 *buf, int xc, int yc); 9 | void FCEU_DrawGunSight(uint8 *buf, int xc, int yc); 10 | -------------------------------------------------------------------------------- /source/fceultra/input/toprider.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2003 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include "share.h" 23 | 24 | static uint32 bs,bss; 25 | static uint32 boop; 26 | 27 | static uint8 Read(int w, uint8 ret) 28 | { 29 | if(w) 30 | { 31 | ret|=(bs&1)<<3; 32 | ret|=(boop&1)<<4; 33 | bs>>=1; 34 | boop>>=1; 35 | // puts("Read"); 36 | } 37 | return(ret); 38 | } 39 | 40 | static void Write(uint8 V) 41 | { 42 | // if(V&0x2) 43 | bs=bss; 44 | //printf("Write: %02x\n",V); 45 | // boop=0xC0; 46 | } 47 | 48 | static void Update(void *data, int arg) 49 | { 50 | bss=*(uint8*)data; 51 | bss|=bss<<8; 52 | bss|=bss<<8; 53 | } 54 | 55 | static INPUTCFC TopRider={Read,Write,0,Update,0,0}; 56 | 57 | INPUTCFC *FCEU_InitTopRider(void) 58 | { 59 | 60 | return(&TopRider); 61 | } 62 | 63 | -------------------------------------------------------------------------------- /source/fceultra/input/zapper.h: -------------------------------------------------------------------------------- 1 | #ifndef _ZAPPER_H_ 2 | #define _ZAPPER_H_ 3 | 4 | #include "../types.h" 5 | 6 | struct ZAPPER 7 | { 8 | uint32 mzx,mzy,mzb; 9 | int zap_readbit; 10 | uint8 bogo; 11 | int zappo; 12 | uint64 zaphit; 13 | uint32 lastInput; 14 | }; 15 | 16 | #endif 17 | -------------------------------------------------------------------------------- /source/fceultra/netplay.h: -------------------------------------------------------------------------------- 1 | int InitNetplay(void); 2 | void NetplayUpdate(uint8 *joyp); 3 | extern int FCEUnetplay; 4 | 5 | 6 | #define FCEUNPCMD_RESET 0x01 7 | #define FCEUNPCMD_POWER 0x02 8 | 9 | #define FCEUNPCMD_VSUNICOIN 0x07 10 | #define FCEUNPCMD_VSUNIDIP0 0x08 11 | #define FCEUNPCMD_FDSINSERTx 0x10 12 | #define FCEUNPCMD_FDSINSERT 0x18 13 | //#define FCEUNPCMD_FDSEJECT 0x19 14 | #define FCEUNPCMD_FDSSELECT 0x1A 15 | 16 | #define FCEUNPCMD_LOADSTATE 0x80 17 | 18 | #define FCEUNPCMD_SAVESTATE 0x81 /* Sent from server to client. */ 19 | #define FCEUNPCMD_LOADCHEATS 0x82 20 | #define FCEUNPCMD_TEXT 0x90 21 | 22 | int FCEUNET_SendCommand(uint8, uint32); 23 | int FCEUNET_SendFile(uint8 cmd, char *); 24 | -------------------------------------------------------------------------------- /source/fceultra/nsf.h: -------------------------------------------------------------------------------- 1 | #ifndef NSF_H 2 | #define NSF_H 3 | 4 | /* FCE Ultra - NES/Famicom Emulator 5 | * 6 | * Copyright notice for this file: 7 | * Copyright (C) 2002 Xodnizel 8 | * 9 | * This program is free software; you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation; either version 2 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * This program is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with this program; if not, write to the Free Software 21 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 | */ 23 | 24 | typedef struct { 25 | char ID[5]; /*NESM^Z*/ 26 | uint8 Version; 27 | uint8 TotalSongs; 28 | uint8 StartingSong; 29 | uint8 LoadAddressLow; 30 | uint8 LoadAddressHigh; 31 | uint8 InitAddressLow; 32 | uint8 InitAddressHigh; 33 | uint8 PlayAddressLow; 34 | uint8 PlayAddressHigh; 35 | uint8 SongName[32]; 36 | uint8 Artist[32]; 37 | uint8 Copyright[32]; 38 | uint8 NTSCspeed[2]; // Unused 39 | uint8 BankSwitch[8]; 40 | uint8 PALspeed[2]; // Unused 41 | uint8 VideoSystem; 42 | uint8 SoundChip; 43 | uint8 Expansion[4]; 44 | uint8 reserve[8]; 45 | } NSF_HEADER; 46 | void NSF_init(void); 47 | void DrawNSF(uint8 *XBuf); 48 | extern NSF_HEADER NSFHeader; //mbg merge 6/29/06 49 | extern uint8 *NSFDATA; 50 | extern int NSFMaxBank; 51 | void NSFDealloc(void); 52 | void NSFDodo(void); 53 | void DoNSFFrame(void); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /source/fceultra/palette.h: -------------------------------------------------------------------------------- 1 | typedef struct { 2 | uint8 r,g,b; 3 | } pal; 4 | 5 | extern pal *palo; 6 | void FCEU_ResetPalette(void); 7 | 8 | void FCEU_ResetPalette(void); 9 | void FCEU_ResetMessages(); 10 | void FCEU_LoadGamePalette(void); 11 | void FCEU_DrawNTSCControlBars(uint8 *XBuf); 12 | -------------------------------------------------------------------------------- /source/fceultra/palettes/rp2c04001.h: -------------------------------------------------------------------------------- 1 | {0xff, 0xb6, 0xb6}, 2 | {0xda, 0x6d, 0xff}, 3 | {0xff, 0x00, 0x00}, 4 | {0x91, 0x91, 0xff}, 5 | {0x00, 0x91, 0x91}, 6 | {0x24, 0x48, 0x00}, 7 | {0x48, 0x48, 0x48}, 8 | {0xff, 0x00, 0x91}, 9 | {0xff, 0xff, 0xff}, 10 | {0x6d, 0x6d, 0x6d}, 11 | {0xff, 0xb6, 0x00}, 12 | {0xb6, 0x00, 0x6d}, 13 | {0x91, 0x00, 0x6d}, 14 | {0xda, 0xda, 0x00}, 15 | {0x6d, 0x48, 0x00}, 16 | {0xff, 0xff, 0xff}, 17 | {0x6d, 0xb6, 0xff}, 18 | {0xda, 0xb6, 0x6d}, 19 | {0x6d, 0x24, 0x00}, 20 | {0x6d, 0xda, 0x00}, 21 | {0x91, 0xda, 0xff}, 22 | {0xda, 0xb6, 0xff}, 23 | {0xff, 0xda, 0x91}, 24 | {0x00, 0x48, 0xff}, 25 | {0xff, 0xda, 0x00}, 26 | {0x48, 0xff, 0xda}, 27 | {0x00, 0x00, 0x00}, 28 | {0x48, 0x00, 0x00}, 29 | {0xda, 0xda, 0xda}, 30 | {0x91, 0x91, 0x91}, 31 | {0xff, 0x00, 0xff}, 32 | {0x00, 0x24, 0x91}, 33 | {0x00, 0x00, 0x6d}, 34 | {0xb6, 0xda, 0xff}, 35 | {0xff, 0xb6, 0xff}, 36 | {0x00, 0xff, 0x00}, 37 | {0x00, 0xff, 0xff}, 38 | {0x00, 0x48, 0x48}, 39 | {0x00, 0xb6, 0x6d}, 40 | {0xb6, 0x00, 0xff}, 41 | {0x00, 0x00, 0x00}, 42 | {0x91, 0x48, 0x00}, 43 | {0xff, 0x91, 0xff}, 44 | {0xb6, 0x24, 0x00}, 45 | {0x91, 0x00, 0xff}, 46 | {0x00, 0x00, 0xda}, 47 | {0xff, 0x91, 0x00}, 48 | {0x00, 0x00, 0x00}, 49 | {0x00, 0x00, 0x00}, 50 | {0x24, 0x91, 0x00}, 51 | {0xb6, 0xb6, 0xb6}, 52 | {0x00, 0x6d, 0x24}, 53 | {0xb6, 0xff, 0x48}, 54 | {0x6d, 0x48, 0xda}, 55 | {0xff, 0xff, 0x00}, 56 | {0xda, 0x6d, 0x00}, 57 | {0x00, 0x48, 0x00}, 58 | {0x00, 0x6d, 0xda}, 59 | {0x00, 0x91, 0x00}, 60 | {0x24, 0x24, 0x24}, 61 | {0xff, 0xff, 0x6d}, 62 | {0xff, 0x6d, 0xff}, 63 | {0x91, 0x6d, 0x00}, 64 | {0x91, 0xff, 0x6d}, 65 | -------------------------------------------------------------------------------- /source/fceultra/palettes/rp2c04002.h: -------------------------------------------------------------------------------- 1 | {0x00, 0x00, 0x00}, 2 | {0xff, 0xb6, 0x00}, 3 | {0x91, 0x6d, 0x00}, 4 | {0xb6, 0xff, 0x48}, 5 | {0x91, 0xff, 0x6d}, 6 | {0xff, 0x6d, 0xff}, 7 | {0x00, 0x91, 0x91}, 8 | {0xb6, 0xda, 0xff}, 9 | {0xff, 0x00, 0x00}, 10 | {0x91, 0x00, 0xff}, 11 | {0xff, 0xff, 0x6d}, 12 | {0xff, 0x91, 0xff}, 13 | {0xff, 0xff, 0xff}, 14 | {0xda, 0x6d, 0xff}, 15 | {0x91, 0xda, 0xff}, 16 | {0x00, 0x91, 0x00}, 17 | {0x00, 0x48, 0x00}, 18 | {0x6d, 0xb6, 0xff}, 19 | {0xb6, 0x24, 0x00}, 20 | {0xda, 0xda, 0xda}, 21 | {0x00, 0xb6, 0x6d}, 22 | {0x6d, 0xda, 0x00}, 23 | {0x48, 0x00, 0x00}, 24 | {0x91, 0x91, 0xff}, 25 | {0x48, 0x48, 0x48}, 26 | {0xff, 0x00, 0xff}, 27 | {0x00, 0x00, 0x6d}, 28 | {0x48, 0xff, 0xda}, 29 | {0xda, 0xb6, 0xff}, 30 | {0x6d, 0x48, 0x00}, 31 | {0x00, 0x00, 0x00}, 32 | {0x6d, 0x48, 0xda}, 33 | {0x91, 0x00, 0x6d}, 34 | {0xff, 0xda, 0x91}, 35 | {0xff, 0x91, 0x00}, 36 | {0xff, 0xb6, 0xff}, 37 | {0x00, 0x6d, 0xda}, 38 | {0x6d, 0x24, 0x00}, 39 | {0xb6, 0xb6, 0xb6}, 40 | {0x00, 0x00, 0xda}, 41 | {0xb6, 0x00, 0xff}, 42 | {0xff, 0xda, 0x00}, 43 | {0x6d, 0x6d, 0x6d}, 44 | {0x24, 0x48, 0x00}, 45 | {0x00, 0x48, 0xff}, 46 | {0x00, 0x00, 0x00}, 47 | {0xda, 0xda, 0x00}, 48 | {0xff, 0xff, 0xff}, 49 | {0xda, 0xb6, 0x6d}, 50 | {0x24, 0x24, 0x24}, 51 | {0x00, 0xff, 0x00}, 52 | {0xda, 0x6d, 0x00}, 53 | {0x00, 0x48, 0x48}, 54 | {0x00, 0x24, 0x91}, 55 | {0xff, 0x00, 0x91}, 56 | {0x24, 0x91, 0x00}, 57 | {0x00, 0x00, 0x00}, 58 | {0x00, 0xff, 0xff}, 59 | {0x91, 0x48, 0x00}, 60 | {0xff, 0xff, 0x00}, 61 | {0xff, 0xb6, 0xb6}, 62 | {0xb6, 0x00, 0x6d}, 63 | {0x00, 0x6d, 0x24}, 64 | {0x91, 0x91, 0x91}, 65 | -------------------------------------------------------------------------------- /source/fceultra/palettes/rp2c04003.h: -------------------------------------------------------------------------------- 1 | {0xb6, 0x00, 0xff}, 2 | {0xff, 0x6d, 0xff}, 3 | {0x91, 0xff, 0x6d}, 4 | {0xb6, 0xb6, 0xb6}, 5 | {0x00, 0x91, 0x00}, 6 | {0xff, 0xff, 0xff}, 7 | {0xb6, 0xda, 0xff}, 8 | {0x24, 0x48, 0x00}, 9 | {0x00, 0x24, 0x91}, 10 | {0x00, 0x00, 0x00}, 11 | {0xff, 0xda, 0x91}, 12 | {0x6d, 0x48, 0x00}, 13 | {0xff, 0x00, 0x91}, 14 | {0xda, 0xda, 0xda}, 15 | {0xda, 0xb6, 0x6d}, 16 | {0x91, 0xda, 0xff}, 17 | {0x91, 0x91, 0xff}, 18 | {0x00, 0x91, 0x91}, 19 | {0xb6, 0x00, 0x6d}, 20 | {0x00, 0x48, 0xff}, 21 | {0x24, 0x91, 0x00}, 22 | {0x91, 0x6d, 0x00}, 23 | {0xda, 0x6d, 0x00}, 24 | {0x00, 0xb6, 0x6d}, 25 | {0x6d, 0x6d, 0x6d}, 26 | {0x6d, 0x48, 0xda}, 27 | {0x00, 0x00, 0x00}, 28 | {0x00, 0x00, 0xda}, 29 | {0xff, 0x00, 0x00}, 30 | {0xb6, 0x24, 0x00}, 31 | {0xff, 0x91, 0xff}, 32 | {0xff, 0xb6, 0xb6}, 33 | {0xda, 0x6d, 0xff}, 34 | {0x00, 0x48, 0x00}, 35 | {0x00, 0x00, 0x6d}, 36 | {0xff, 0xff, 0x00}, 37 | {0x24, 0x24, 0x24}, 38 | {0xff, 0xb6, 0x00}, 39 | {0xff, 0x91, 0x00}, 40 | {0xff, 0xff, 0xff}, 41 | {0x6d, 0xda, 0x00}, 42 | {0x91, 0x00, 0x6d}, 43 | {0x6d, 0xb6, 0xff}, 44 | {0xff, 0x00, 0xff}, 45 | {0x00, 0x6d, 0xda}, 46 | {0x91, 0x91, 0x91}, 47 | {0x00, 0x00, 0x00}, 48 | {0x6d, 0x24, 0x00}, 49 | {0x00, 0xff, 0xff}, 50 | {0x48, 0x00, 0x00}, 51 | {0xb6, 0xff, 0x48}, 52 | {0xff, 0xb6, 0xff}, 53 | {0x91, 0x48, 0x00}, 54 | {0x00, 0xff, 0x00}, 55 | {0xda, 0xda, 0x00}, 56 | {0x48, 0x48, 0x48}, 57 | {0x00, 0x6d, 0x24}, 58 | {0x00, 0x00, 0x00}, 59 | {0xda, 0xb6, 0xff}, 60 | {0xff, 0xff, 0x6d}, 61 | {0x91, 0x00, 0xff}, 62 | {0x48, 0xff, 0xda}, 63 | {0xff, 0xda, 0x00}, 64 | {0x00, 0x48, 0x48}, 65 | -------------------------------------------------------------------------------- /source/fceultra/palettes/rp2c05004.h: -------------------------------------------------------------------------------- 1 | {0x91, 0x6d, 0x00}, 2 | {0x6d, 0x48, 0xda}, 3 | {0x00, 0x91, 0x91}, 4 | {0xda, 0xda, 0x00}, 5 | {0x00, 0x00, 0x00}, 6 | {0xff, 0xb6, 0xb6}, 7 | {0x00, 0x24, 0x91}, 8 | {0xda, 0x6d, 0x00}, 9 | {0xb6, 0xb6, 0xb6}, 10 | {0x6d, 0x24, 0x00}, 11 | {0x00, 0xff, 0x00}, 12 | {0x00, 0x00, 0x6d}, 13 | {0xff, 0xda, 0x91}, 14 | {0xff, 0xff, 0x00}, 15 | {0x00, 0x91, 0x00}, 16 | {0xb6, 0xff, 0x48}, 17 | {0xff, 0x6d, 0xff}, 18 | {0x48, 0x00, 0x00}, 19 | {0x00, 0x48, 0xff}, 20 | {0xff, 0x91, 0xff}, 21 | {0x00, 0x00, 0x00}, 22 | {0x48, 0x48, 0x48}, 23 | {0xb6, 0x24, 0x00}, 24 | {0xff, 0x91, 0x00}, 25 | {0xda, 0xb6, 0x6d}, 26 | {0x00, 0xb6, 0x6d}, 27 | {0x91, 0x91, 0xff}, 28 | {0x24, 0x91, 0x00}, 29 | {0x91, 0x00, 0x6d}, 30 | {0x00, 0x00, 0x00}, 31 | {0x91, 0xff, 0x6d}, 32 | {0x6d, 0xb6, 0xff}, 33 | {0xb6, 0x00, 0x6d}, 34 | {0x00, 0x6d, 0x24}, 35 | {0x91, 0x48, 0x00}, 36 | {0x00, 0x00, 0xda}, 37 | {0x91, 0x00, 0xff}, 38 | {0xb6, 0x00, 0xff}, 39 | {0x6d, 0x6d, 0x6d}, 40 | {0xff, 0x00, 0x91}, 41 | {0x00, 0x48, 0x48}, 42 | {0xda, 0xda, 0xda}, 43 | {0x00, 0x6d, 0xda}, 44 | {0x00, 0x48, 0x00}, 45 | {0x24, 0x24, 0x24}, 46 | {0xff, 0xff, 0x6d}, 47 | {0x91, 0x91, 0x91}, 48 | {0xff, 0x00, 0xff}, 49 | {0xff, 0xb6, 0xff}, 50 | {0xff, 0xff, 0xff}, 51 | {0x6d, 0x48, 0x00}, 52 | {0xff, 0x00, 0x00}, 53 | {0xff, 0xda, 0x00}, 54 | {0x48, 0xff, 0xda}, 55 | {0xff, 0xff, 0xff}, 56 | {0x91, 0xda, 0xff}, 57 | {0x00, 0x00, 0x00}, 58 | {0xff, 0xb6, 0x00}, 59 | {0xda, 0x6d, 0xff}, 60 | {0xb6, 0xda, 0xff}, 61 | {0x6d, 0xda, 0x00}, 62 | {0xda, 0xb6, 0xff}, 63 | {0x00, 0xff, 0xff}, 64 | {0x24, 0x48, 0x00}, 65 | -------------------------------------------------------------------------------- /source/fceultra/ppu.h: -------------------------------------------------------------------------------- 1 | void FCEUPPU_Init(void); 2 | void FCEUPPU_Reset(void); 3 | void FCEUPPU_Power(void); 4 | int FCEUPPU_Loop(int skip); 5 | 6 | void FCEUPPU_LineUpdate(); 7 | void FCEUPPU_SetVideoSystem(int w); 8 | 9 | extern void (*PPU_hook)(uint32 A); 10 | extern void (*GameHBIRQHook)(void), (*GameHBIRQHook2)(void); 11 | 12 | int newppu_get_scanline(); 13 | int newppu_get_dot(); 14 | void newppu_hacky_emergency_reset(); 15 | 16 | /* For cart.c and banksw.h, mostly */ 17 | extern uint8 NTARAM[0x800], *vnapage[4]; 18 | extern uint8 PPUNTARAM; 19 | extern uint8 PPUCHRRAM; 20 | 21 | void FCEUPPU_SaveState(void); 22 | void FCEUPPU_LoadState(int version); 23 | uint32 FCEUPPU_PeekAddress(); 24 | uint8* FCEUPPU_GetCHR(uint32 vadr, uint32 refreshaddr); 25 | int FCEUPPU_GetAttr(int ntnum, int xt, int yt); 26 | void ppu_getScroll(int &xpos, int &ypos); 27 | 28 | 29 | #ifdef _MSC_VER 30 | #define FASTCALL __fastcall 31 | #else 32 | #define FASTCALL 33 | #endif 34 | 35 | void PPU_ResetHooks(); 36 | extern uint8 (FASTCALL *FFCEUX_PPURead)(uint32 A); 37 | extern void (*FFCEUX_PPUWrite)(uint32 A, uint8 V); 38 | extern uint8 FASTCALL FFCEUX_PPURead_Default(uint32 A); 39 | void FFCEUX_PPUWrite_Default(uint32 A, uint8 V); 40 | 41 | extern int g_rasterpos; 42 | extern uint8 PPU[4]; 43 | extern bool DMC_7bit; 44 | extern bool paldeemphswap; 45 | 46 | enum PPUPHASE { 47 | PPUPHASE_VBL, PPUPHASE_BG, PPUPHASE_OBJ 48 | }; 49 | 50 | extern PPUPHASE ppuphase; 51 | -------------------------------------------------------------------------------- /source/fceultra/utils/backward.cpp: -------------------------------------------------------------------------------- 1 | // Pick your poison. 2 | // 3 | // On GNU/Linux, you have few choices to get the most out of your stack trace. 4 | // 5 | // By default you get: 6 | // - object filename 7 | // - function name 8 | // 9 | // In order to add: 10 | // - source filename 11 | // - line and column numbers 12 | // - source code snippet (assuming the file is accessible) 13 | 14 | // Install one of the following library then uncomment one of the macro (or 15 | // better, add the detection of the lib and the macro definition in your build 16 | // system) 17 | 18 | // - apt-get install libdw-dev ... 19 | // - g++/clang++ -ldw ... 20 | // #define BACKWARD_HAS_DW 1 21 | 22 | // - apt-get install binutils-dev ... 23 | // - g++/clang++ -lbfd ... 24 | // #define BACKWARD_HAS_BFD 1 25 | #if BACKWARD_HAS_DW==1 26 | #include "backward.hpp" 27 | 28 | namespace backward { 29 | 30 | backward::SignalHandling sh; 31 | 32 | } // namespace backward 33 | #endif 34 | -------------------------------------------------------------------------------- /source/fceultra/utils/crc32.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include "../types.h" 22 | #include "crc32.h" 23 | 24 | #include 25 | uint32 CalcCRC32(uint32 crc, uint8 *buf, uint32 len) 26 | { 27 | return(crc32(crc,buf,len)); 28 | } 29 | 30 | uint32 FCEUI_CRC32(uint32 crc, uint8 *buf, uint32 len) 31 | { 32 | return(CalcCRC32(crc,buf,len)); 33 | } 34 | -------------------------------------------------------------------------------- /source/fceultra/utils/crc32.h: -------------------------------------------------------------------------------- 1 | uint32 CalcCRC32(uint32 crc, uint8 *buf, uint32 len); 2 | -------------------------------------------------------------------------------- /source/fceultra/utils/general.cpp: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | #include 22 | #include 23 | #include 24 | #include "../types.h" 25 | 26 | uint32 uppow2(uint32 n) 27 | { 28 | int x; 29 | 30 | for(x=31;x>=0;x--) 31 | if(n&(1< 3 | void FCEU_Guid::newGuid() 4 | { 5 | for(int i=0;i='A') a=a-'A'+10; 31 | else a-='0'; 32 | if(b>='A') b=b-'A'+10; 33 | else b-='0'; 34 | return ((unsigned char)a<<4)|(unsigned char)b; 35 | } 36 | 37 | void FCEU_Guid::scan(std::string& str) 38 | { 39 | char* endptr = (char*)str.c_str(); 40 | FCEU_en32lsb(data,strtoul(endptr,&endptr,16)); 41 | FCEU_en16lsb(data+4,strtoul(endptr+1,&endptr,16)); 42 | FCEU_en16lsb(data+6,strtoul(endptr+1,&endptr,16)); 43 | FCEU_en16lsb(data+8,strtoul(endptr+1,&endptr,16)); 44 | endptr++; 45 | for(int i=0;i<6;i++) 46 | data[10+i] = hexToByte(&endptr); 47 | } 48 | -------------------------------------------------------------------------------- /source/fceultra/utils/guid.h: -------------------------------------------------------------------------------- 1 | #ifndef _guid_h_ 2 | #define _guid_h_ 3 | 4 | #include 5 | #include "../types.h" 6 | #include "valuearray.h" 7 | 8 | struct FCEU_Guid : public ValueArray 9 | { 10 | void newGuid(); 11 | std::string toString(); 12 | static FCEU_Guid fromString(std::string str); 13 | static uint8 hexToByte(char** ptrptr); 14 | void scan(std::string& str); 15 | }; 16 | 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /source/fceultra/utils/md5.h: -------------------------------------------------------------------------------- 1 | #ifndef _MD5_H 2 | #define _MD5_H 3 | 4 | #include "../types.h" 5 | #include "valuearray.h" 6 | 7 | struct md5_context 8 | { 9 | uint32 total[2]; 10 | uint32 state[4]; 11 | uint8 buffer[64]; 12 | }; 13 | 14 | typedef ValueArray MD5DATA; 15 | 16 | void md5_starts( struct md5_context *ctx ); 17 | void md5_update( struct md5_context *ctx, uint8 *input, uint32 length ); 18 | void md5_finish( struct md5_context *ctx, uint8 digest[16] ); 19 | 20 | /* Uses a static buffer, so beware of how it's used. */ 21 | char *md5_asciistr(MD5DATA& md5); 22 | 23 | #endif /* md5.h */ 24 | -------------------------------------------------------------------------------- /source/fceultra/utils/memory.h: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /* Various macros for faster memory stuff 22 | (at least that's the idea) 23 | */ 24 | 25 | #define FCEU_dwmemset(d,c,n) {int _x; for(_x=n-4;_x>=0;_x-=4) *(uint32 *)&(d)[_x]=c;} 26 | 27 | void *FCEU_malloc(uint32 size); // initialized to 0 28 | void *FCEU_gmalloc(uint32 size); // used by boards for WRAM etc, initialized to 0 (default) or other via RAMInitOption 29 | void FCEU_gfree(void *ptr); 30 | void FCEU_free(void *ptr); 31 | void FCEU_memmove(void *d, void *s, uint32 l); 32 | 33 | // wrapper for debugging when its needed, otherwise act like 34 | // normal malloc/free 35 | void *FCEU_dmalloc(uint32 size); 36 | void FCEU_dfree(void *ptr); 37 | -------------------------------------------------------------------------------- /source/fceultra/utils/valuearray.h: -------------------------------------------------------------------------------- 1 | #ifndef _VALUEARRAY_H_ 2 | #define _VALUEARRAY_H_ 3 | 4 | template 5 | struct ValueArray 6 | { 7 | T data[N]; 8 | T &operator[](int index) { return data[index]; } 9 | static const int size = N; 10 | bool operator!=(ValueArray &other) { return !operator==(other); } 11 | bool operator==(ValueArray &other) 12 | { 13 | for(int i=0;i 16 | 17 | #define MAXJOLIET 255 18 | #ifdef HW_DOL 19 | #define MAX_BROWSER_SIZE 1000 20 | #else 21 | #define MAX_BROWSER_SIZE 3000 22 | #endif 23 | 24 | typedef struct 25 | { 26 | char dir[MAXPATHLEN + 1]; // directory path of browserList 27 | int numEntries; // # of entries in browserList 28 | int selIndex; // currently selected index of browserList 29 | int pageIndex; // starting index of browserList page display 30 | int size; // # of entries browerList has space allocated to store 31 | } BROWSERINFO; 32 | 33 | typedef struct 34 | { 35 | size_t length; // file length 36 | int isdir; // 0 - file, 1 - directory 37 | char filename[MAXJOLIET + 1]; // full filename 38 | char displayname[MAXJOLIET + 1]; // name for browser display 39 | int filenum; // file # (for 7z support) 40 | int icon; // icon to display 41 | } BROWSERENTRY; 42 | 43 | extern BROWSERINFO browser; 44 | extern BROWSERENTRY * browserList; 45 | 46 | enum 47 | { 48 | ICON_NONE, 49 | ICON_FOLDER, 50 | ICON_SD, 51 | ICON_USB, 52 | ICON_DVD, 53 | ICON_SMB 54 | }; 55 | 56 | extern char romFilename[]; 57 | extern bool loadingFile; 58 | extern char szname[MAXPATHLEN]; 59 | extern bool inSz; 60 | 61 | bool MakeFilePath(char filepath[], int type, char * filename = NULL, int filenum = -2); 62 | int UpdateDirName(); 63 | int OpenGameList(); 64 | int autoLoadMethod(); 65 | int autoSaveMethod(bool silent); 66 | int FileSortCallback(const void *f1, const void *f2); 67 | void StripExt(char* returnstring, char * inputstring); 68 | bool IsSz(); 69 | void ResetBrowser(); 70 | bool AddBrowserEntry(); 71 | bool IsDeviceRoot(char * path); 72 | int BrowserLoadSz(); 73 | int BrowserChangeFolder(); 74 | int BrowserLoadFile(); 75 | 76 | #endif 77 | -------------------------------------------------------------------------------- /source/fileop.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2008-2009 6 | * 7 | * fileop.h 8 | * 9 | * File operations 10 | ****************************************************************************/ 11 | 12 | #ifndef _FILEOP_H_ 13 | #define _FILEOP_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define SAVEBUFFERSIZE (1024 * 512) 20 | 21 | void InitDeviceThread(); 22 | void ResumeDeviceThread(); 23 | void HaltDeviceThread(); 24 | void HaltParseThread(); 25 | void MountAllFAT(); 26 | void UnmountAllFAT(); 27 | bool FindDevice(char * filepath, int * device); 28 | char * StripDevice(char * path); 29 | bool ChangeInterface(int device, bool silent); 30 | bool ChangeInterface(char * filepath, bool silent); 31 | void CreateAppPath(char * origpath); 32 | bool GetFileSize(int i); 33 | void FindAndSelectLastLoadedFile(); 34 | int ParseDirectory(bool waitParse = false, bool filter = true); 35 | bool CreateDirectory(char * path); 36 | void AllocSaveBuffer(); 37 | void FreeSaveBuffer(); 38 | size_t LoadFile(char * rbuffer, char *filepath, size_t length, bool silent); 39 | size_t LoadFile(char * filepath, bool silent); 40 | size_t LoadSzFile(char * filepath, unsigned char * rbuffer); 41 | size_t SaveFile(char * buffer, char *filepath, size_t datasize, bool silent); 42 | size_t SaveFile(char * filepath, size_t datasize, bool silent); 43 | 44 | extern unsigned char *savebuffer; 45 | extern FILE * file; 46 | extern bool unmountRequired[]; 47 | extern bool isMounted[]; 48 | extern int selectLoadedFile; 49 | 50 | #endif 51 | -------------------------------------------------------------------------------- /source/fonts/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/fonts/font.ttf -------------------------------------------------------------------------------- /source/gcaudio.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2008-2009 6 | * eke-eke October 2008 7 | * 8 | * gcaudio.h 9 | * 10 | * Audio driver 11 | ****************************************************************************/ 12 | 13 | void InitialiseAudio(); 14 | void ResetAudio(); 15 | void PlaySound( int *Buffer, int samples ); 16 | void SwitchAudioMode(int mode); 17 | void ShutdownAudio(); 18 | void UpdateSampleRate(int rate); 19 | void SetSampleRate(); 20 | -------------------------------------------------------------------------------- /source/gcunzip.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric September 2008 6 | * 7 | * gcunzip.h 8 | * 9 | * Unzip routines 10 | ****************************************************************************/ 11 | #ifndef _GCUNZIP_H_ 12 | #define _GCUNZIP_H_ 13 | 14 | int IsZipFile (char *buffer); 15 | char * GetFirstZipFilename(); 16 | size_t UnZipBuffer (unsigned char *outbuffer); 17 | int SzParse(char * filepath); 18 | size_t SzExtractFile(int i, unsigned char *buffer); 19 | void SzClose(); 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /source/gcvideo.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2008-2009 6 | * 7 | * gcvideo.h 8 | * 9 | * Video rendering 10 | ****************************************************************************/ 11 | 12 | #ifndef _GCVIDEO_H_ 13 | #define _GCVIDEO_H_ 14 | 15 | // color palettes 16 | #define MAXPAL 11 17 | 18 | struct st_palettes { 19 | char name[32], desc[32]; 20 | unsigned int data[64]; 21 | }; 22 | 23 | void InitGCVideo (); 24 | void StopGX(); 25 | void ResetVideo_Emu (); 26 | void RenderFrame(unsigned char *XBuf); 27 | void RenderStereoFrames(unsigned char *XBufLeft, unsigned char *XBufRight); //CAK: Stereoscopic 3D 28 | void setFrameTimer(); 29 | void SyncSpeed(); 30 | void SetPalette(); 31 | void ResetVideo_Menu (); 32 | void TakeScreenshot(); 33 | void Menu_Render (); 34 | void Menu_DrawImg(f32 xpos, f32 ypos, u16 width, u16 height, u8 data[], f32 degrees, f32 scaleX, f32 scaleY, u8 alphaF ); 35 | void Menu_DrawRectangle(f32 x, f32 y, f32 width, f32 height, GXColor color, u8 filled); 36 | void Check3D(); 37 | 38 | extern GXRModeObj *vmode; 39 | extern int screenheight; 40 | extern int screenwidth; 41 | extern u8 * gameScreenTex; 42 | extern u8 * gameScreenPng; 43 | extern int gameScreenPngSize; 44 | extern struct st_palettes palettes[]; 45 | extern int FDSSwitchRequested; 46 | extern bool progressive; 47 | extern u32 FrameTimer; 48 | extern bool shutter_3d_mode; 49 | extern bool anaglyph_3d_mode; 50 | extern bool eye_3d; 51 | 52 | #endif -------------------------------------------------------------------------------- /source/gui/gui_imagedata.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * libwiigui 3 | * 4 | * Tantric 2009 5 | * 6 | * gui_imagedata.cpp 7 | * 8 | * GUI class definitions 9 | ***************************************************************************/ 10 | 11 | #include "gui.h" 12 | 13 | /** 14 | * Constructor for the GuiImageData class. 15 | */ 16 | GuiImageData::GuiImageData(const u8 * i, int maxw, int maxh) 17 | { 18 | data = NULL; 19 | width = 0; 20 | height = 0; 21 | 22 | if(i) 23 | data = DecodePNG(i, &width, &height, data, maxw, maxh); 24 | } 25 | 26 | /** 27 | * Destructor for the GuiImageData class. 28 | */ 29 | GuiImageData::~GuiImageData() 30 | { 31 | if(data) 32 | { 33 | free(data); 34 | data = NULL; 35 | } 36 | } 37 | 38 | u8 * GuiImageData::GetImage() 39 | { 40 | return data; 41 | } 42 | 43 | int GuiImageData::GetWidth() 44 | { 45 | return width; 46 | } 47 | 48 | int GuiImageData::GetHeight() 49 | { 50 | return height; 51 | } 52 | -------------------------------------------------------------------------------- /source/images/battery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/battery.png -------------------------------------------------------------------------------- /source/images/battery_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/battery_bar.png -------------------------------------------------------------------------------- /source/images/battery_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/battery_red.png -------------------------------------------------------------------------------- /source/images/bg_bottom.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_bottom.png -------------------------------------------------------------------------------- /source/images/bg_game_selection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_game_selection.png -------------------------------------------------------------------------------- /source/images/bg_game_selection_entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_game_selection_entry.png -------------------------------------------------------------------------------- /source/images/bg_options.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_options.png -------------------------------------------------------------------------------- /source/images/bg_options_entry.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_options_entry.png -------------------------------------------------------------------------------- /source/images/bg_preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_preview.png -------------------------------------------------------------------------------- /source/images/bg_top.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/bg_top.png -------------------------------------------------------------------------------- /source/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button.png -------------------------------------------------------------------------------- /source/images/button_arrow_down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_down.png -------------------------------------------------------------------------------- /source/images/button_arrow_down_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_down_over.png -------------------------------------------------------------------------------- /source/images/button_arrow_left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_left.png -------------------------------------------------------------------------------- /source/images/button_arrow_left_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_left_over.png -------------------------------------------------------------------------------- /source/images/button_arrow_right.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_right.png -------------------------------------------------------------------------------- /source/images/button_arrow_right_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_right_over.png -------------------------------------------------------------------------------- /source/images/button_arrow_up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_up.png -------------------------------------------------------------------------------- /source/images/button_arrow_up_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_arrow_up_over.png -------------------------------------------------------------------------------- /source/images/button_gamesave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_gamesave.png -------------------------------------------------------------------------------- /source/images/button_gamesave_blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_gamesave_blank.png -------------------------------------------------------------------------------- /source/images/button_gamesave_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_gamesave_over.png -------------------------------------------------------------------------------- /source/images/button_large.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_large.png -------------------------------------------------------------------------------- /source/images/button_large_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_large_over.png -------------------------------------------------------------------------------- /source/images/button_long.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_long.png -------------------------------------------------------------------------------- /source/images/button_long_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_long_over.png -------------------------------------------------------------------------------- /source/images/button_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_over.png -------------------------------------------------------------------------------- /source/images/button_palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_palette.png -------------------------------------------------------------------------------- /source/images/button_palette_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_palette_over.png -------------------------------------------------------------------------------- /source/images/button_prompt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_prompt.png -------------------------------------------------------------------------------- /source/images/button_prompt_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_prompt_over.png -------------------------------------------------------------------------------- /source/images/button_short.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_short.png -------------------------------------------------------------------------------- /source/images/button_short_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_short_over.png -------------------------------------------------------------------------------- /source/images/button_small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_small.png -------------------------------------------------------------------------------- /source/images/button_small_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/button_small_over.png -------------------------------------------------------------------------------- /source/images/credits_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/credits_box.png -------------------------------------------------------------------------------- /source/images/dialogue_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/dialogue_box.png -------------------------------------------------------------------------------- /source/images/icon_dvd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_dvd.png -------------------------------------------------------------------------------- /source/images/icon_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_folder.png -------------------------------------------------------------------------------- /source/images/icon_game_cheats.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_cheats.png -------------------------------------------------------------------------------- /source/images/icon_game_controllers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_controllers.png -------------------------------------------------------------------------------- /source/images/icon_game_delete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_delete.png -------------------------------------------------------------------------------- /source/images/icon_game_load.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_load.png -------------------------------------------------------------------------------- /source/images/icon_game_reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_reset.png -------------------------------------------------------------------------------- /source/images/icon_game_save.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_save.png -------------------------------------------------------------------------------- /source/images/icon_game_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_game_settings.png -------------------------------------------------------------------------------- /source/images/icon_home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_home.png -------------------------------------------------------------------------------- /source/images/icon_sd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_sd.png -------------------------------------------------------------------------------- /source/images/icon_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings.png -------------------------------------------------------------------------------- /source/images/icon_settings_classic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_classic.png -------------------------------------------------------------------------------- /source/images/icon_settings_file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_file.png -------------------------------------------------------------------------------- /source/images/icon_settings_gamecube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_gamecube.png -------------------------------------------------------------------------------- /source/images/icon_settings_mappings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_mappings.png -------------------------------------------------------------------------------- /source/images/icon_settings_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_menu.png -------------------------------------------------------------------------------- /source/images/icon_settings_nescontroller.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_nescontroller.png -------------------------------------------------------------------------------- /source/images/icon_settings_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_network.png -------------------------------------------------------------------------------- /source/images/icon_settings_nunchuk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_nunchuk.png -------------------------------------------------------------------------------- /source/images/icon_settings_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_screenshot.png -------------------------------------------------------------------------------- /source/images/icon_settings_video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_video.png -------------------------------------------------------------------------------- /source/images/icon_settings_wiimote.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_wiimote.png -------------------------------------------------------------------------------- /source/images/icon_settings_wiiupro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_wiiupro.png -------------------------------------------------------------------------------- /source/images/icon_settings_zapper.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_settings_zapper.png -------------------------------------------------------------------------------- /source/images/icon_smb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_smb.png -------------------------------------------------------------------------------- /source/images/icon_usb.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/icon_usb.png -------------------------------------------------------------------------------- /source/images/keyboard_key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_key.png -------------------------------------------------------------------------------- /source/images/keyboard_key_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_key_over.png -------------------------------------------------------------------------------- /source/images/keyboard_largekey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_largekey.png -------------------------------------------------------------------------------- /source/images/keyboard_largekey_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_largekey_over.png -------------------------------------------------------------------------------- /source/images/keyboard_mediumkey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_mediumkey.png -------------------------------------------------------------------------------- /source/images/keyboard_mediumkey_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_mediumkey_over.png -------------------------------------------------------------------------------- /source/images/keyboard_textbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/keyboard_textbox.png -------------------------------------------------------------------------------- /source/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/logo.png -------------------------------------------------------------------------------- /source/images/logo_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/logo_over.png -------------------------------------------------------------------------------- /source/images/player1_grab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player1_grab.png -------------------------------------------------------------------------------- /source/images/player1_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player1_point.png -------------------------------------------------------------------------------- /source/images/player2_grab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player2_grab.png -------------------------------------------------------------------------------- /source/images/player2_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player2_point.png -------------------------------------------------------------------------------- /source/images/player3_grab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player3_grab.png -------------------------------------------------------------------------------- /source/images/player3_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player3_point.png -------------------------------------------------------------------------------- /source/images/player4_grab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player4_grab.png -------------------------------------------------------------------------------- /source/images/player4_point.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/player4_point.png -------------------------------------------------------------------------------- /source/images/progressbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/progressbar.png -------------------------------------------------------------------------------- /source/images/progressbar_empty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/progressbar_empty.png -------------------------------------------------------------------------------- /source/images/progressbar_outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/progressbar_outline.png -------------------------------------------------------------------------------- /source/images/screen_position.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/screen_position.png -------------------------------------------------------------------------------- /source/images/scrollbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar.png -------------------------------------------------------------------------------- /source/images/scrollbar_arrowdown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_arrowdown.png -------------------------------------------------------------------------------- /source/images/scrollbar_arrowdown_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_arrowdown_over.png -------------------------------------------------------------------------------- /source/images/scrollbar_arrowup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_arrowup.png -------------------------------------------------------------------------------- /source/images/scrollbar_arrowup_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_arrowup_over.png -------------------------------------------------------------------------------- /source/images/scrollbar_box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_box.png -------------------------------------------------------------------------------- /source/images/scrollbar_box_over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/scrollbar_box_over.png -------------------------------------------------------------------------------- /source/images/throbber.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/images/throbber.png -------------------------------------------------------------------------------- /source/lang/en.lang: -------------------------------------------------------------------------------- 1 | msgid " " 2 | msgstr "" 3 | -------------------------------------------------------------------------------- /source/lang/es.lang: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/lang/es.lang -------------------------------------------------------------------------------- /source/lang/nl.lang: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/lang/nl.lang -------------------------------------------------------------------------------- /source/memfile.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric October 2008 6 | * 7 | * memfile.h 8 | * 9 | * Memory-based replacement for standard C file functions 10 | * This allows standard file calls to be replaced by memory based ones 11 | * With little modification required to the code 12 | ***************************************************************************/ 13 | 14 | #ifndef _MEMFILE_H_ 15 | #define _MEMFILE_H_ 16 | 17 | typedef struct MFile { 18 | char *buffer; // pointer to buffer memory 19 | long int offset; // current position indicator in buffer 20 | long int size; // total file (buffer) size 21 | } MFILE; 22 | 23 | #define MSEEK_SET 0 24 | #define MSEEK_CUR 1 25 | #define MSEEK_END 2 26 | #define MEOF (-1) 27 | 28 | MFILE * memfopen(char * buffer, int size); 29 | int memfclose(MFILE * src); 30 | int memfseek ( MFILE * m, long int offset, int origin ); 31 | long int memftell (MFILE * stream); 32 | size_t memfread(void * dst, size_t size, size_t count, MFILE * src); 33 | int memfgetc(MFILE * src); 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /source/menu.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric 2008-2009 6 | * 7 | * menu.h 8 | * 9 | * Main menu flow control 10 | ****************************************************************************/ 11 | 12 | #ifndef _MENU_H 13 | #define _MENU_H 14 | 15 | bool GuiLoaded(); 16 | void InitGUIThreads(); 17 | void MainMenu (int menuitem); 18 | void ErrorPrompt(const char * msg); 19 | int ErrorPromptRetry(const char * msg); 20 | void InfoPrompt(const char * msg); 21 | void ShowAction (const char *msg); 22 | void CancelAction(); 23 | void ShowProgress (const char *msg, int done, int total); 24 | void ResetText(); 25 | 26 | enum 27 | { 28 | MENU_EXIT = -1, 29 | MENU_NONE, 30 | MENU_SETTINGS, 31 | MENU_SETTINGS_FILE, 32 | MENU_SETTINGS_MENU, 33 | MENU_SETTINGS_NETWORK, 34 | MENU_GAMESELECTION, 35 | MENU_GAME, 36 | MENU_GAME_SAVE, 37 | MENU_GAME_LOAD, 38 | MENU_GAME_DELETE, 39 | MENU_GAMESETTINGS, 40 | MENU_GAMESETTINGS_MAPPINGS, 41 | MENU_GAMESETTINGS_MAPPINGS_CTRL, 42 | MENU_GAMESETTINGS_MAPPINGS_MAP, 43 | MENU_GAMESETTINGS_VIDEO, 44 | MENU_GAMESETTINGS_CHEATS 45 | }; 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /source/networkop.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric December 2008 6 | * 7 | * networkop.h 8 | * 9 | * Network and SMB support routines 10 | ****************************************************************************/ 11 | 12 | #ifndef _NETWORKOP_H_ 13 | #define _NETWORKOP_H_ 14 | ; 15 | bool ConnectShare (bool silent); 16 | void CloseShare(); 17 | 18 | #endif -------------------------------------------------------------------------------- /source/pad.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric September 2008 6 | * 7 | * pad.h 8 | * 9 | * Controller input 10 | ****************************************************************************/ 11 | 12 | #ifndef _PAD_H_ 13 | #define _PAD_H_ 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | #define PI 3.14159265f 20 | #define PADCAL 50 21 | #define WUPCCAL 400 22 | #define MAXJP 11 23 | #define RAPID_A 256 24 | #define RAPID_B 512 25 | 26 | extern int rumbleRequest[4]; 27 | extern u32 btnmap[2][4][12]; 28 | 29 | void SetControllers(); 30 | void ResetControls(int cc = -1, int wc = -1); 31 | void ShutoffRumble(); 32 | void DoRumble(int i); 33 | void GetJoy(); 34 | bool MenuRequested(); 35 | void SetupPads(); 36 | void UpdatePads(); 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /source/patch.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric October 2008 6 | * 7 | * patch.h 8 | * 9 | * IPS/UPS/PPF patch support 10 | ***************************************************************************/ 11 | 12 | #ifndef PATCH_H 13 | #define PATCH_H 14 | 15 | #include "memfile.h" 16 | 17 | int LoadPatch(int size); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /source/preferences.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * FCE Ultra 3 | * Nintendo Wii/Gamecube Port 4 | * 5 | * Tantric September 2008 6 | * 7 | * preferences.h 8 | * 9 | * Preferences save/load preferences utilities 10 | ****************************************************************************/ 11 | 12 | void FixInvalidSettings(); 13 | void DefaultSettings(); 14 | bool SavePrefs (bool silent); 15 | bool LoadPrefs (); 16 | -------------------------------------------------------------------------------- /source/sounds/bg_music.ogg: -------------------------------------------------------------------------------- 1 | bg_music.ogg -------------------------------------------------------------------------------- /source/sounds/button_click.pcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/sounds/button_click.pcm -------------------------------------------------------------------------------- /source/sounds/button_over.pcm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/sounds/button_over.pcm -------------------------------------------------------------------------------- /source/sounds/enter.ogg: -------------------------------------------------------------------------------- 1 | enter.ogg -------------------------------------------------------------------------------- /source/sounds/exit.ogg: -------------------------------------------------------------------------------- 1 | exit.ogg -------------------------------------------------------------------------------- /source/utils/gettext.h: -------------------------------------------------------------------------------- 1 | #ifndef _GETTEXT_H_ 2 | #define _GETTEXT_H_ 3 | 4 | bool LoadLanguage(); 5 | 6 | /* 7 | * input msg = a text in ASCII 8 | * output = the translated msg in utf-8 9 | */ 10 | const char *gettext(const char *msg); 11 | 12 | #endif /* _GETTEXT_H_ */ 13 | -------------------------------------------------------------------------------- /source/utils/memory.h: -------------------------------------------------------------------------------- 1 | /* FCE Ultra - NES/Famicom Emulator 2 | * 3 | * Copyright notice for this file: 4 | * Copyright (C) 2002 Xodnizel 5 | * 6 | * This program is free software; you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation; either version 2 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | */ 20 | 21 | /* Various macros for faster memory stuff 22 | (at least that's the idea) 23 | */ 24 | 25 | #define FCEU_dwmemset(d,c,n) {int _x; for(_x=n-4;_x>=0;_x-=4) *(uint32 *)&(d)[_x]=c;} 26 | 27 | void *FCEU_malloc(uint32 size); 28 | void *FCEU_gmalloc(uint32 size); 29 | void FCEU_gfree(void *ptr); 30 | void FCEU_free(void *ptr); 31 | void FCEU_memmove(void *d, void *s, uint32 l); 32 | 33 | // wrapper for debugging when its needed, otherwise act like 34 | // normal malloc/free 35 | void *FCEU_dmalloc(uint32 size); 36 | void FCEU_dfree(void *ptr); 37 | -------------------------------------------------------------------------------- /source/utils/oggplayer.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/utils/oggplayer.c -------------------------------------------------------------------------------- /source/utils/oggplayer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niuus/FCEUltraRX/9b690c1ef79642f379fe2505bc6ed0a44ce91256/source/utils/oggplayer.h -------------------------------------------------------------------------------- /source/utils/sz/7zAlloc.c: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.c */ 2 | 3 | #include 4 | #include "7zAlloc.h" 5 | 6 | /* #define _SZ_ALLOC_DEBUG */ 7 | /* use _SZ_ALLOC_DEBUG to debug alloc/free operations */ 8 | 9 | #ifdef _SZ_ALLOC_DEBUG 10 | 11 | #ifdef _WIN32 12 | #include 13 | #endif 14 | #include 15 | int g_allocCount = 0; 16 | int g_allocCountTemp = 0; 17 | #endif 18 | 19 | void *SzAlloc(size_t size) 20 | { 21 | if (size == 0) 22 | return 0; 23 | #ifdef _SZ_ALLOC_DEBUG 24 | fprintf(stderr, "\nAlloc %10d bytes; count = %10d", size, g_allocCount); 25 | g_allocCount++; 26 | #endif 27 | return malloc(size); 28 | } 29 | 30 | void SzFree(void *address) 31 | { 32 | #ifdef _SZ_ALLOC_DEBUG 33 | if (address != 0) 34 | { 35 | g_allocCount--; 36 | fprintf(stderr, "\nFree; count = %10d", g_allocCount); 37 | } 38 | #endif 39 | free(address); 40 | } 41 | 42 | void *SzAllocTemp(size_t size) 43 | { 44 | if (size == 0) 45 | return 0; 46 | #ifdef _SZ_ALLOC_DEBUG 47 | fprintf(stderr, "\nAlloc_temp %10d bytes; count = %10d", size, g_allocCountTemp); 48 | g_allocCountTemp++; 49 | #ifdef _WIN32 50 | return HeapAlloc(GetProcessHeap(), 0, size); 51 | #endif 52 | #endif 53 | return malloc(size); 54 | } 55 | 56 | void SzFreeTemp(void *address) 57 | { 58 | #ifdef _SZ_ALLOC_DEBUG 59 | if (address != 0) 60 | { 61 | g_allocCountTemp--; 62 | fprintf(stderr, "\nFree_temp; count = %10d", g_allocCountTemp); 63 | } 64 | #ifdef _WIN32 65 | HeapFree(GetProcessHeap(), 0, address); 66 | return; 67 | #endif 68 | #endif 69 | free(address); 70 | } 71 | -------------------------------------------------------------------------------- /source/utils/sz/7zAlloc.h: -------------------------------------------------------------------------------- 1 | /* 7zAlloc.h */ 2 | 3 | #ifndef __7Z_ALLOC_H 4 | #define __7Z_ALLOC_H 5 | 6 | #include 7 | 8 | typedef struct _ISzAlloc 9 | { 10 | void *(*Alloc)(size_t size); 11 | void (*Free)(void *address); /* address can be 0 */ 12 | } ISzAlloc; 13 | 14 | void *SzAlloc(size_t size); 15 | void SzFree(void *address); 16 | 17 | void *SzAllocTemp(size_t size); 18 | void SzFreeTemp(void *address); 19 | 20 | #endif 21 | -------------------------------------------------------------------------------- /source/utils/sz/7zBuffer.c: -------------------------------------------------------------------------------- 1 | /* 7zBuffer.c */ 2 | 3 | #include "7zBuffer.h" 4 | #include "7zAlloc.h" 5 | 6 | void SzByteBufferInit(CSzByteBuffer *buffer) 7 | { 8 | buffer->Capacity = 0; 9 | buffer->Items = 0; 10 | } 11 | 12 | int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size)) 13 | { 14 | buffer->Capacity = newCapacity; 15 | if (newCapacity == 0) 16 | { 17 | buffer->Items = 0; 18 | return 1; 19 | } 20 | buffer->Items = (Byte *)allocFunc(newCapacity); 21 | return (buffer->Items != 0); 22 | } 23 | 24 | void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *)) 25 | { 26 | freeFunc(buffer->Items); 27 | buffer->Items = 0; 28 | buffer->Capacity = 0; 29 | } 30 | -------------------------------------------------------------------------------- /source/utils/sz/7zBuffer.h: -------------------------------------------------------------------------------- 1 | /* 7zBuffer.h */ 2 | 3 | #ifndef __7Z_BUFFER_H 4 | #define __7Z_BUFFER_H 5 | 6 | #include 7 | #include "7zTypes.h" 8 | 9 | typedef struct _CSzByteBuffer 10 | { 11 | size_t Capacity; 12 | Byte *Items; 13 | }CSzByteBuffer; 14 | 15 | void SzByteBufferInit(CSzByteBuffer *buffer); 16 | int SzByteBufferCreate(CSzByteBuffer *buffer, size_t newCapacity, void * (*allocFunc)(size_t size)); 17 | void SzByteBufferFree(CSzByteBuffer *buffer, void (*freeFunc)(void *)); 18 | 19 | #endif 20 | -------------------------------------------------------------------------------- /source/utils/sz/7zCrc.c: -------------------------------------------------------------------------------- 1 | /* 7zCrc.c */ 2 | 3 | #include "7zCrc.h" 4 | 5 | #define kCrcPoly 0xEDB88320 6 | 7 | UInt32 g_CrcTable[256]; 8 | 9 | void InitCrcTable() 10 | { 11 | UInt32 i; 12 | for (i = 0; i < 256; i++) 13 | { 14 | UInt32 r = i; 15 | int j; 16 | for (j = 0; j < 8; j++) 17 | if (r & 1) 18 | r = (r >> 1) ^ kCrcPoly; 19 | else 20 | r >>= 1; 21 | g_CrcTable[i] = r; 22 | } 23 | } 24 | 25 | void CrcInit(UInt32 *crc) { *crc = 0xFFFFFFFF; } 26 | UInt32 CrcGetDigest(UInt32 *crc) { return *crc ^ 0xFFFFFFFF; } 27 | 28 | void CrcUpdateByte(UInt32 *crc, Byte b) 29 | { 30 | *crc = g_CrcTable[((Byte)(*crc)) ^ b] ^ (*crc >> 8); 31 | } 32 | 33 | void CrcUpdateUInt16(UInt32 *crc, UInt16 v) 34 | { 35 | CrcUpdateByte(crc, (Byte)v); 36 | CrcUpdateByte(crc, (Byte)(v >> 8)); 37 | } 38 | 39 | void CrcUpdateUInt32(UInt32 *crc, UInt32 v) 40 | { 41 | int i; 42 | for (i = 0; i < 4; i++) 43 | CrcUpdateByte(crc, (Byte)(v >> (8 * i))); 44 | } 45 | 46 | void CrcUpdateUInt64(UInt32 *crc, UInt64 v) 47 | { 48 | int i; 49 | for (i = 0; i < 8; i++) 50 | { 51 | CrcUpdateByte(crc, (Byte)(v)); 52 | v >>= 8; 53 | } 54 | } 55 | 56 | void CrcUpdate(UInt32 *crc, const void *data, size_t size) 57 | { 58 | UInt32 v = *crc; 59 | const Byte *p = (const Byte *)data; 60 | for (; size > 0 ; size--, p++) 61 | v = g_CrcTable[((Byte)(v)) ^ *p] ^ (v >> 8); 62 | *crc = v; 63 | } 64 | 65 | UInt32 CrcCalculateDigest(const void *data, size_t size) 66 | { 67 | UInt32 crc; 68 | CrcInit(&crc); 69 | CrcUpdate(&crc, data, size); 70 | return CrcGetDigest(&crc); 71 | } 72 | 73 | int CrcVerifyDigest(UInt32 digest, const void *data, size_t size) 74 | { 75 | return (CrcCalculateDigest(data, size) == digest); 76 | } 77 | -------------------------------------------------------------------------------- /source/utils/sz/7zCrc.h: -------------------------------------------------------------------------------- 1 | /* 7zCrc.h */ 2 | 3 | #ifndef __7Z_CRC_H 4 | #define __7Z_CRC_H 5 | 6 | #include 7 | 8 | #include "7zTypes.h" 9 | 10 | extern UInt32 g_CrcTable[256]; 11 | void InitCrcTable(); 12 | 13 | void CrcInit(UInt32 *crc); 14 | UInt32 CrcGetDigest(UInt32 *crc); 15 | void CrcUpdateByte(UInt32 *crc, Byte v); 16 | void CrcUpdateUInt16(UInt32 *crc, UInt16 v); 17 | void CrcUpdateUInt32(UInt32 *crc, UInt32 v); 18 | void CrcUpdateUInt64(UInt32 *crc, UInt64 v); 19 | void CrcUpdate(UInt32 *crc, const void *data, size_t size); 20 | 21 | UInt32 CrcCalculateDigest(const void *data, size_t size); 22 | int CrcVerifyDigest(UInt32 digest, const void *data, size_t size); 23 | 24 | #endif 25 | -------------------------------------------------------------------------------- /source/utils/sz/7zDecode.h: -------------------------------------------------------------------------------- 1 | /* 7zDecode.h */ 2 | 3 | #if defined(_LZMA_OUT_READ) && !defined(_LZMA_IN_CB) 4 | #error "Fixme: _LZMA_OUT_READ && _LZMA_IN_CB isn't currently possible!" 5 | #endif 6 | 7 | #ifndef __7Z_DECODE_H 8 | #define __7Z_DECODE_H 9 | 10 | #include "7zItem.h" 11 | #include "7zAlloc.h" 12 | #ifdef _LZMA_IN_CB 13 | #include "7zIn.h" 14 | #endif 15 | 16 | SZ_RESULT SzDecode(const CFileSize *packSizes, const CFolder *folder, 17 | #ifdef _LZMA_IN_CB 18 | ISzInStream *stream, 19 | #else 20 | const Byte *inBuffer, 21 | #endif 22 | Byte *outBuffer, size_t outSize, 23 | size_t *outSizeProcessed, ISzAlloc *allocMain); 24 | 25 | #ifdef _LZMA_OUT_READ 26 | #ifndef _LZMA_TEMP_BUFFER_SIZE 27 | #define _LZMA_TEMP_BUFFER_SIZE (2048) // size of the temporary buffer in bytes 28 | #endif 29 | 30 | SZ_RESULT SzDecode2(const CFileSize *packSizes, const CFolder *folder, 31 | ISzInStream *stream, 32 | Byte *outBuffer, size_t outSize, 33 | size_t *outSizeProcessed, ISzAlloc *allocMain, 34 | size_t *fileOffset, size_t *fileSize); 35 | #endif // #ifdef _LZMA_OUT_READ 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /source/utils/sz/7zHeader.c: -------------------------------------------------------------------------------- 1 | /* 7zHeader.c */ 2 | 3 | #include "7zHeader.h" 4 | 5 | Byte k7zSignature[k7zSignatureSize] = {'7', 'z', 0xBC, 0xAF, 0x27, 0x1C}; 6 | -------------------------------------------------------------------------------- /source/utils/sz/7zHeader.h: -------------------------------------------------------------------------------- 1 | /* 7zHeader.h */ 2 | 3 | #ifndef __7Z_HEADER_H 4 | #define __7Z_HEADER_H 5 | 6 | #include "7zTypes.h" 7 | 8 | #define k7zSignatureSize 6 9 | extern Byte k7zSignature[k7zSignatureSize]; 10 | 11 | #define k7zMajorVersion 0 12 | 13 | #define k7zStartHeaderSize 0x20 14 | 15 | enum EIdEnum 16 | { 17 | k7zIdEnd, 18 | 19 | k7zIdHeader, 20 | 21 | k7zIdArchiveProperties, 22 | 23 | k7zIdAdditionalStreamsInfo, 24 | k7zIdMainStreamsInfo, 25 | k7zIdFilesInfo, 26 | 27 | k7zIdPackInfo, 28 | k7zIdUnPackInfo, 29 | k7zIdSubStreamsInfo, 30 | 31 | k7zIdSize, 32 | k7zIdCRC, 33 | 34 | k7zIdFolder, 35 | 36 | k7zIdCodersUnPackSize, 37 | k7zIdNumUnPackStream, 38 | 39 | k7zIdEmptyStream, 40 | k7zIdEmptyFile, 41 | k7zIdAnti, 42 | 43 | k7zIdName, 44 | k7zIdCreationTime, 45 | k7zIdLastAccessTime, 46 | k7zIdLastWriteTime, 47 | k7zIdWinAttributes, 48 | k7zIdComment, 49 | 50 | k7zIdEncodedHeader, 51 | 52 | k7zIdStartPos 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /source/utils/sz/7zIn.h: -------------------------------------------------------------------------------- 1 | /* 7zIn.h */ 2 | 3 | #ifndef __7Z_IN_H 4 | #define __7Z_IN_H 5 | 6 | #include "7zHeader.h" 7 | #include "7zItem.h" 8 | #include "7zAlloc.h" 9 | 10 | typedef struct _CInArchiveInfo 11 | { 12 | CFileSize StartPositionAfterHeader; 13 | CFileSize DataStartPosition; 14 | }CInArchiveInfo; 15 | 16 | typedef struct _CArchiveDatabaseEx 17 | { 18 | CArchiveDatabase Database; 19 | CInArchiveInfo ArchiveInfo; 20 | UInt32 *FolderStartPackStreamIndex; 21 | CFileSize *PackStreamStartPositions; 22 | UInt32 *FolderStartFileIndex; 23 | UInt32 *FileIndexToFolderIndexMap; 24 | }CArchiveDatabaseEx; 25 | 26 | void SzArDbExInit(CArchiveDatabaseEx *db); 27 | void SzArDbExFree(CArchiveDatabaseEx *db, void (*freeFunc)(void *)); 28 | CFileSize SzArDbGetFolderStreamPos(CArchiveDatabaseEx *db, UInt32 folderIndex, UInt32 indexInFolder); 29 | CFileSize SzArDbGetFolderFullPackSize(CArchiveDatabaseEx *db, UInt32 folderIndex); 30 | 31 | typedef struct _ISzInStream 32 | { 33 | #ifdef _LZMA_IN_CB 34 | SZ_RESULT (*Read)( 35 | void *object, /* pointer to ISzInStream itself */ 36 | void **buffer, /* out: pointer to buffer with data */ 37 | size_t maxRequiredSize, /* max required size to read */ 38 | size_t *processedSize); /* real processed size. 39 | processedSize can be less than maxRequiredSize. 40 | If processedSize == 0, then there are no more 41 | bytes in stream. */ 42 | #else 43 | SZ_RESULT (*Read)(void *object, void *buffer, size_t size, size_t *processedSize); 44 | #endif 45 | SZ_RESULT (*Seek)(void *object, CFileSize pos); 46 | } ISzInStream; 47 | 48 | 49 | int SzArchiveOpen( 50 | ISzInStream *inStream, 51 | CArchiveDatabaseEx *db, 52 | ISzAlloc *allocMain, 53 | ISzAlloc *allocTemp); 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /source/utils/sz/7zItem.h: -------------------------------------------------------------------------------- 1 | /* 7zItem.h */ 2 | 3 | #ifndef __7Z_ITEM_H 4 | #define __7Z_ITEM_H 5 | 6 | #include "7zMethodID.h" 7 | #include "7zHeader.h" 8 | #include "7zBuffer.h" 9 | 10 | typedef struct _CCoderInfo 11 | { 12 | UInt32 NumInStreams; 13 | UInt32 NumOutStreams; 14 | CMethodID MethodID; 15 | CSzByteBuffer Properties; 16 | }CCoderInfo; 17 | 18 | void SzCoderInfoInit(CCoderInfo *coder); 19 | void SzCoderInfoFree(CCoderInfo *coder, void (*freeFunc)(void *p)); 20 | 21 | typedef struct _CBindPair 22 | { 23 | UInt32 InIndex; 24 | UInt32 OutIndex; 25 | }CBindPair; 26 | 27 | typedef struct _CFolder 28 | { 29 | UInt32 NumCoders; 30 | CCoderInfo *Coders; 31 | UInt32 NumBindPairs; 32 | CBindPair *BindPairs; 33 | UInt32 NumPackStreams; 34 | UInt32 *PackStreams; 35 | CFileSize *UnPackSizes; 36 | int UnPackCRCDefined; 37 | UInt32 UnPackCRC; 38 | 39 | UInt32 NumUnPackStreams; 40 | }CFolder; 41 | 42 | void SzFolderInit(CFolder *folder); 43 | CFileSize SzFolderGetUnPackSize(CFolder *folder); 44 | int SzFolderFindBindPairForInStream(CFolder *folder, UInt32 inStreamIndex); 45 | UInt32 SzFolderGetNumOutStreams(CFolder *folder); 46 | CFileSize SzFolderGetUnPackSize(CFolder *folder); 47 | 48 | /* #define CArchiveFileTime UInt64 */ 49 | 50 | typedef struct _CFileItem 51 | { 52 | /* 53 | CArchiveFileTime LastWriteTime; 54 | CFileSize StartPos; 55 | UInt32 Attributes; 56 | */ 57 | CFileSize Size; 58 | UInt32 FileCRC; 59 | char *Name; 60 | 61 | Byte IsFileCRCDefined; 62 | Byte HasStream; 63 | Byte IsDirectory; 64 | Byte IsAnti; 65 | /* 66 | int AreAttributesDefined; 67 | int IsLastWriteTimeDefined; 68 | int IsStartPosDefined; 69 | */ 70 | }CFileItem; 71 | 72 | void SzFileInit(CFileItem *fileItem); 73 | 74 | typedef struct _CArchiveDatabase 75 | { 76 | UInt32 NumPackStreams; 77 | CFileSize *PackSizes; 78 | Byte *PackCRCsDefined; 79 | UInt32 *PackCRCs; 80 | UInt32 NumFolders; 81 | CFolder *Folders; 82 | UInt32 NumFiles; 83 | CFileItem *Files; 84 | }CArchiveDatabase; 85 | 86 | void SzArchiveDatabaseInit(CArchiveDatabase *db); 87 | void SzArchiveDatabaseFree(CArchiveDatabase *db, void (*freeFunc)(void *)); 88 | 89 | 90 | #endif 91 | -------------------------------------------------------------------------------- /source/utils/sz/7zMethodID.c: -------------------------------------------------------------------------------- 1 | /* 7zMethodID.c */ 2 | 3 | #include "7zMethodID.h" 4 | 5 | int AreMethodsEqual(CMethodID *a1, CMethodID *a2) 6 | { 7 | int i; 8 | if (a1->IDSize != a2->IDSize) 9 | return 0; 10 | for (i = 0; i < a1->IDSize; i++) 11 | if (a1->ID[i] != a2->ID[i]) 12 | return 0; 13 | return 1; 14 | } 15 | -------------------------------------------------------------------------------- /source/utils/sz/7zMethodID.h: -------------------------------------------------------------------------------- 1 | /* 7zMethodID.h */ 2 | 3 | #ifndef __7Z_METHOD_ID_H 4 | #define __7Z_METHOD_ID_H 5 | 6 | #include "7zTypes.h" 7 | 8 | #define kMethodIDSize 15 9 | 10 | typedef struct _CMethodID 11 | { 12 | Byte ID[kMethodIDSize]; 13 | Byte IDSize; 14 | } CMethodID; 15 | 16 | int AreMethodsEqual(CMethodID *a1, CMethodID *a2); 17 | 18 | #endif 19 | -------------------------------------------------------------------------------- /source/utils/sz/7zTypes.h: -------------------------------------------------------------------------------- 1 | /* 7zTypes.h */ 2 | 3 | #ifndef __COMMON_TYPES_H 4 | #define __COMMON_TYPES_H 5 | 6 | #ifndef _7ZIP_BYTE_DEFINED 7 | #define _7ZIP_BYTE_DEFINED 8 | #ifndef ZCONF_H 9 | typedef unsigned char Byte; 10 | #endif 11 | #endif 12 | 13 | #ifndef _7ZIP_UINT16_DEFINED 14 | #define _7ZIP_UINT16_DEFINED 15 | typedef unsigned short UInt16; 16 | #endif 17 | 18 | #ifndef _7ZIP_UINT32_DEFINED 19 | #define _7ZIP_UINT32_DEFINED 20 | #ifdef _LZMA_UINT32_IS_ULONG 21 | typedef unsigned long UInt32; 22 | #else 23 | typedef unsigned int UInt32; 24 | #endif 25 | #endif 26 | 27 | /* #define _SZ_NO_INT_64 */ 28 | /* define it your compiler doesn't support long long int */ 29 | 30 | #ifndef _7ZIP_UINT64_DEFINED 31 | #define _7ZIP_UINT64_DEFINED 32 | #ifdef _SZ_NO_INT_64 33 | typedef unsigned long UInt64; 34 | #else 35 | #ifdef _MSC_VER 36 | typedef unsigned __int64 UInt64; 37 | #else 38 | typedef unsigned long long int UInt64; 39 | #endif 40 | #endif 41 | #endif 42 | 43 | 44 | /* #define _SZ_FILE_SIZE_64 */ 45 | /* Use _SZ_FILE_SIZE_64 if you need support for files larger than 4 GB*/ 46 | 47 | #ifndef CFileSize 48 | #ifdef _SZ_FILE_SIZE_64 49 | typedef UInt64 CFileSize; 50 | #else 51 | typedef UInt32 CFileSize; 52 | #endif 53 | #endif 54 | 55 | #define SZ_RESULT int 56 | 57 | #define SZ_OK (0) 58 | #define SZE_DATA_ERROR (1) 59 | #define SZE_OUTOFMEMORY (2) 60 | #define SZE_CRC_ERROR (3) 61 | 62 | #define SZE_NOTIMPL (4) 63 | #define SZE_FAIL (5) 64 | #define SZE_FAILREAD (6) 65 | 66 | #define SZE_ARCHIVE_ERROR (7) 67 | 68 | #define SZE_OUTOFMEMORYDIC (8) 69 | 70 | #define RINOK(x) { int __result_ = (x); if(__result_ != 0) return __result_; } 71 | 72 | #endif 73 | -------------------------------------------------------------------------------- /source/utils/sz/LzmaTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | LzmaTypes.h 3 | 4 | Types for LZMA Decoder 5 | 6 | This file written and distributed to public domain by Igor Pavlov. 7 | This file is part of LZMA SDK 4.40 (2006-05-01) 8 | */ 9 | 10 | #ifndef __LZMATYPES_H 11 | #define __LZMATYPES_H 12 | 13 | #ifndef _7ZIP_BYTE_DEFINED 14 | #define _7ZIP_BYTE_DEFINED 15 | typedef unsigned char Byte; 16 | #endif 17 | 18 | #ifndef _7ZIP_UINT16_DEFINED 19 | #define _7ZIP_UINT16_DEFINED 20 | typedef unsigned short UInt16; 21 | #endif 22 | 23 | #ifndef _7ZIP_UINT32_DEFINED 24 | #define _7ZIP_UINT32_DEFINED 25 | #ifdef _LZMA_UINT32_IS_ULONG 26 | typedef unsigned long UInt32; 27 | #else 28 | typedef unsigned int UInt32; 29 | #endif 30 | #endif 31 | 32 | /* #define _LZMA_SYSTEM_SIZE_T */ 33 | /* Use system's size_t. You can use it to enable 64-bit sizes supporting */ 34 | 35 | #ifndef _7ZIP_SIZET_DEFINED 36 | #define _7ZIP_SIZET_DEFINED 37 | #ifdef _LZMA_SYSTEM_SIZE_T 38 | #include 39 | typedef size_t SizeT; 40 | #else 41 | typedef UInt32 SizeT; 42 | #endif 43 | #endif 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /source/utils/unzip/miniunz.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _miniunz_H 3 | #define _miniunz_H 4 | 5 | int extractZip(unzFile uf,int opt_extract_without_path,int opt_overwrite,const char* password); 6 | int extractZipOnefile(unzFile uf,const char* filename,int opt_extract_without_path,int opt_overwrite,const char* password); 7 | int makedir(char *newdir); 8 | 9 | #endif 10 | -------------------------------------------------------------------------------- /source/utils/vm/dsihandler.s: -------------------------------------------------------------------------------- 1 | /* Copyright 2013 tueidj All Rights Reserved 2 | * This code may not be used in any project 3 | * without explicit permission from the author. 4 | */ 5 | 6 | #include 7 | #include "asm.h" 8 | 9 | .extern vm_dsi_handler 10 | .extern default_exceptionhandler 11 | 12 | FUNC_START(dsi_handler) 13 | stwu sp,-EXCEPTION_FRAME_END(sp) 14 | stw r6,GPR6_OFFSET(sp) 15 | stw r7,GPR7_OFFSET(sp) 16 | stw r8,GPR8_OFFSET(sp) 17 | stw r9,GPR9_OFFSET(sp) 18 | stw r10,GPR10_OFFSET(sp) 19 | stw r11,GPR11_OFFSET(sp) 20 | stw r12,GPR12_OFFSET(sp) 21 | mfdsisr r4 22 | mfmsr r3 23 | ori r3,r3,MSR_RI 24 | mtmsr r3 25 | 26 | addi r3,sp,8 27 | bl vm_dsi_handler 28 | 29 | # check if it was handled correctly 30 | cmplwi r3,0 31 | 32 | lwz r6,GPR6_OFFSET(sp) 33 | lwz r7,GPR7_OFFSET(sp) 34 | lwz r8,GPR8_OFFSET(sp) 35 | lwz r9,GPR9_OFFSET(sp) 36 | lwz r10,GPR10_OFFSET(sp) 37 | lwz r11,GPR11_OFFSET(sp) 38 | lwz r12,GPR12_OFFSET(sp) 39 | 40 | # clear MSR_RI 41 | mfmsr r3 42 | rlwinm r3,r3,0,31,29 43 | mtmsr r3 44 | 45 | bne 1f 46 | 47 | # jump to libogc's default handler 48 | addi sp,sp,EXCEPTION_FRAME_END 49 | b default_exceptionhandler 50 | 51 | 1: 52 | lwz r3,CR_OFFSET(sp) 53 | lwz r4,LR_OFFSET(sp) 54 | lwz r5,CTR_OFFSET(sp) 55 | lwz r0,XER_OFFSET(sp) 56 | mtcr r3 57 | mtlr r4 58 | mtctr r5 59 | mtxer r0 60 | lwz r0,GPR0_OFFSET(sp) 61 | lwz r5,GPR5_OFFSET(sp) 62 | 63 | lwz r3,SRR0_OFFSET(sp) 64 | lwz r4,SRR1_OFFSET(sp) 65 | mtsrr0 r3 66 | mtsrr1 r4 67 | lwz r3,GPR3_OFFSET(sp) 68 | lwz r4,GPR4_OFFSET(sp) 69 | lwz sp,GPR1_OFFSET(sp) 70 | rfi 71 | FUNC_END(dsi_handler) 72 | 73 | -------------------------------------------------------------------------------- /source/vmalloc.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Snes9x Nintendo Wii/Gamecube Port 3 | * 4 | * emu_kidid 2015 5 | * 6 | * vmalloc.cpp 7 | * 8 | * GC VM memory allocator 9 | ***************************************************************************/ 10 | 11 | #ifdef USE_VM 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include "utils/vm/vm.h" 18 | 19 | static heap_cntrl vm_heap; 20 | 21 | static int vm_initialised = 0; 22 | 23 | void InitVmManager () 24 | { 25 | __lwp_heap_init(&vm_heap, (void *)ARAM_VM_BASE, ARAM_SIZE, 32); 26 | vm_initialised = 1; 27 | } 28 | 29 | void* vm_malloc(u32 size) 30 | { 31 | if(!vm_initialised) InitVmManager(); 32 | return __lwp_heap_allocate(&vm_heap, size); 33 | } 34 | 35 | bool vm_free(void *ptr) 36 | { 37 | if(!vm_initialised) InitVmManager(); 38 | return __lwp_heap_free(&vm_heap, ptr); 39 | } 40 | 41 | int vm_size_free() 42 | { 43 | if(!vm_initialised) InitVmManager(); 44 | heap_iblock info; 45 | __lwp_heap_getinfo(&vm_heap,&info); 46 | return info.free_size; 47 | } 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /source/vmalloc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | * Snes9x Nintendo Wii/Gamecube Port 3 | * 4 | * emu_kidid 2015 5 | * 6 | * vmalloc.h 7 | * 8 | * GC VM memory allocator 9 | ***************************************************************************/ 10 | 11 | #ifdef USE_VM 12 | 13 | #ifndef _VMMANAGER_H_ 14 | #define _VMMANAGER_H_ 15 | 16 | void* vm_malloc(u32 size); 17 | bool vm_free(void *ptr); 18 | int vm_size_free(); 19 | #endif 20 | 21 | #endif 22 | --------------------------------------------------------------------------------