From 8e9dfe5d0cc58426147daa0be4008a04480fe844 Mon Sep 17 00:00:00 2001 From: rdanbrook <1869094+rdanbrook@users.noreply.github.com> Date: Mon, 9 Apr 2018 02:05:15 +0800 Subject: [PATCH] Add support for Magic Kid Googoo dump (Mapper190) --- Makefile.am | 1 + libretro/Makefile.common | 1 + source/core/board/NstBoard.cpp | 8 +++ source/core/board/NstBoard.hpp | 2 + source/core/board/NstBoardMagicKidGoogoo.cpp | 65 ++++++++++++++++++++ source/core/board/NstBoardMagicKidGoogoo.hpp | 55 +++++++++++++++++ 6 files changed, 132 insertions(+) create mode 100644 source/core/board/NstBoardMagicKidGoogoo.cpp create mode 100644 source/core/board/NstBoardMagicKidGoogoo.hpp diff --git a/Makefile.am b/Makefile.am index 76a1750..8bf15cc 100644 --- a/Makefile.am +++ b/Makefile.am @@ -547,6 +547,7 @@ nestopia_SOURCES = \ source/core/board/NstBoardBmcFamily4646B.cpp \ source/core/board/NstBoardBtlT230.cpp \ source/core/board/NstBoardBmc1200in1.hpp \ + source/core/board/NstBoardMagicKidGoogoo.cpp \ source/core/board/NstBoardMagicSeries.cpp \ source/core/board/NstBoardSunsoft2.hpp \ source/core/board/NstBoardBmcGoldenCard6in1.hpp \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index 6f8dd55..65153b0 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -190,6 +190,7 @@ SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardKonamiVrc4.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardKonamiVrc6.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardKonamiVrc7.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardKonamiVsSystem.cpp +SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardMagicKidGoogoo.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardMagicSeries.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardMmc1.cpp SOURCES_CXX += $(CORE_DIR)/source/core/board/NstBoardMmc2.cpp diff --git a/source/core/board/NstBoard.cpp b/source/core/board/NstBoard.cpp index 392fb71..d664d8a 100644 --- a/source/core/board/NstBoard.cpp +++ b/source/core/board/NstBoard.cpp @@ -73,6 +73,7 @@ #include "NstBoardKasing.hpp" #include "NstBoardKay.hpp" #include "NstBoardKonami.hpp" +#include "NstBoardMagicKidGoogoo.hpp" #include "NstBoardMagicSeries.hpp" #include "NstBoardNanjing.hpp" #include "NstBoardNihon.hpp" @@ -2880,6 +2881,12 @@ namespace Nes id = Type::TXC_TW; break; + case 190: + + name = "MAGICKIDGOOGOO"; + id = Type::MAGICKIDGOOGOO; + break; + case 191: name = "WAIXING (b)"; @@ -3579,6 +3586,7 @@ namespace Nes case Type::KONAMI_VRC7_0 : case Type::KONAMI_VRC7_1 : return new Konami::Vrc7(c); case Type::KONAMI_VSSYSTEM : return new Konami::VsSystem(c); + case Type::MAGICKIDGOOGOO : return new MagicKidGoogoo(c); case Type::MAGICSERIES_MAGICDRAGON : return new MagicSeries::MagicDragon(c); case Type::NAMCOT_3425 : return new Namcot::N3425(c); case Type::NAMCOT_3433 : return new Namcot::N3433(c); diff --git a/source/core/board/NstBoard.hpp b/source/core/board/NstBoard.hpp index d1eafa2..1fa8aea 100644 --- a/source/core/board/NstBoard.hpp +++ b/source/core/board/NstBoard.hpp @@ -433,6 +433,8 @@ namespace Nes KONAMI_VRC7_0 = MakeId< 85, 512, 256, 0, 0, CRM_0, NMT_V, 0 >::ID, KONAMI_VRC7_1 = MakeId< 85, 512, 256, 8, 0, CRM_0, NMT_V, 0 >::ID, KONAMI_VSSYSTEM = MakeId< 151, 64, 64, 0, 0, CRM_0, NMT_4, 0 >::ID, + //Magic Kid Googoo + MAGICKIDGOOGOO = MakeId< 190, 256, 128, 8, 0, CRM_0, NMT_V, 0 >::ID, // Magic Series MAGICSERIES_MAGICDRAGON = MakeId< 107, 128, 64, 0, 0, CRM_0, NMT_X, 0 >::ID, // Namcot diff --git a/source/core/board/NstBoardMagicKidGoogoo.cpp b/source/core/board/NstBoardMagicKidGoogoo.cpp new file mode 100644 index 0000000..0885305 --- /dev/null +++ b/source/core/board/NstBoardMagicKidGoogoo.cpp @@ -0,0 +1,65 @@ +//////////////////////////////////////////////////////////////////////////////////////// +// +// Nestopia - NES/Famicom emulator written in C++ +// +// Copyright (C) 2003-2008 Martin Freij +// +// This file is part of Nestopia. +// +// Nestopia is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Nestopia is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Nestopia; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//////////////////////////////////////////////////////////////////////////////////////// + +#include "NstBoard.hpp" +#include "NstBoardMagicKidGoogoo.hpp" + +namespace Nes +{ + namespace Core + { + namespace Boards + { + #ifdef NST_MSVC_OPTIMIZE + #pragma optimize("s", on) + #endif + + void MagicKidGoogoo::SubReset(const bool hard) + { + Map( 0x8000U, 0x9FFFU, &MagicKidGoogoo::Poke_8000 ); + Map( 0xC000U, 0xDFFFU, &MagicKidGoogoo::Poke_8000 ); + + for (uint i=0x0000; i < 0x2000; i += 0x04) + { + Map( 0xA000U + i, CHR_SWAP_2K_0 ); + Map( 0xA001U + i, CHR_SWAP_2K_1 ); + Map( 0xA002U + i, CHR_SWAP_2K_2 ); + Map( 0xA003U + i, CHR_SWAP_2K_3 ); + } + + if (hard) + prg.SwapBank(0); + } + + #ifdef NST_MSVC_OPTIMIZE + #pragma optimize("", on) + #endif + + NES_POKE_AD(MagicKidGoogoo, 8000) + { + prg.SwapBank( (address >> 11) | (data & 0x07) ); + } + } + } +} diff --git a/source/core/board/NstBoardMagicKidGoogoo.hpp b/source/core/board/NstBoardMagicKidGoogoo.hpp new file mode 100644 index 0000000..4ce10bc --- /dev/null +++ b/source/core/board/NstBoardMagicKidGoogoo.hpp @@ -0,0 +1,55 @@ +//////////////////////////////////////////////////////////////////////////////////////// +// +// Nestopia - NES/Famicom emulator written in C++ +// +// Copyright (C) 2003-2008 Martin Freij +// +// This file is part of Nestopia. +// +// Nestopia is free software; you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation; either version 2 of the License, or +// (at your option) any later version. +// +// Nestopia is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Nestopia; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +//////////////////////////////////////////////////////////////////////////////////////// + +#ifndef NST_BOARD_MAGICKIDGOOGOO_H +#define NST_BOARD_MAGICKIDGOOGOO_H + +#ifdef NST_PRAGMA_ONCE +#pragma once +#endif + +namespace Nes +{ + namespace Core + { + namespace Boards + { + class MagicKidGoogoo : public Board + { + public: + + explicit MagicKidGoogoo(const Context& c) + : Board(c) {} + + private: + + void SubReset(bool); + + NES_DECL_POKE( 8000 ); + }; + } + } +} + +#endif