Add mednafen snes "faust" core

Speed somewhere between shizzlenineizzle and byuugan.  Some things not hooked up yet.
This commit is contained in:
nattthebear 2020-05-29 19:23:02 -04:00
parent de25b53fe2
commit 5e3971a87b
8 changed files with 187 additions and 9 deletions

BIN
output/dll/faust.wbx Normal file

Binary file not shown.

View File

@ -900,6 +900,8 @@ namespace BizHawk.Client.Common
if (useSnes9x)
{
// TODO
// core = CoreInventory.Instance["SNES", "Faust"];
core = CoreInventory.Instance["SNES", CoreNames.Snes9X];
}
else

View File

@ -0,0 +1,17 @@
using BizHawk.Emulation.Common;
using BizHawk.Emulation.Cores.Waterbox;
namespace BizHawk.Emulation.Cores.Consoles.Nintendo.Faust
{
[Core("Faust", "Mednafen Team", true, false, "1.24.3", "https://mednafen.github.io/releases/", false)]
public class Faust : NymaCore, IRegionable
{
[CoreConstructor("SNES")]
public Faust(GameInfo game, byte[] rom, CoreComm comm, string extension,
NymaSettings settings, NymaSyncSettings syncSettings, bool deterministic)
: base(comm, "SNES", "I don't think anything uses this parameter", settings, syncSettings)
{
DoInit<LibNymaCore>(game, rom, null, "faust.wbx", extension, deterministic);
}
}
}

View File

@ -106,6 +106,15 @@ namespace Mednafen
{
abort();
}
void MDFNSS_SaveSM(Stream *st, bool data_only, const MDFN_Surface *surface, const MDFN_Rect *DisplayRect, const int32 *LineWidths)
{
abort();
}
void MDFNSS_LoadSM(Stream *st, bool data_only, const bool fuzz)
{
abort();
}
static const MDFNSetting* GetSetting(const char* name)
{

View File

@ -59,8 +59,6 @@ ECL_EXPORT bool InitRom(const InitData& data)
{
try
{
Setup();
std::unique_ptr<Stream> gamestream(new FileStream(data.FileNameFull, FileStream::MODE_READ, false));
GameFile gf({
&NVFS,
@ -74,6 +72,8 @@ ECL_EXPORT bool InitRom(const InitData& data)
});
Game->Load(&gf);
Setup();
}
catch(...)
{
@ -88,8 +88,8 @@ ECL_EXPORT bool InitCd(int numdisks)
{
try
{
Setup();
StartGameWithCds(numdisks);
Setup();
}
catch(...)
{

140
waterbox/nyma/faust.cpp Normal file
View File

@ -0,0 +1,140 @@
#include <src/types.h>
#include "nyma.h"
#include <emulibc.h>
#include "mednafen/src/snes_faust/snes.h"
#include <waterboxcore.h>
#include "mednafen/src/snes_faust/ppu.h"
#include "mednafen/src/snes_faust/input.h"
#include "mednafen/src/snes_faust/cart.h"
using namespace MDFN_IEN_SNES_FAUST;
extern Mednafen::MDFNGI EmulatedSNES_Faust;
void SetupMDFNGameInfo()
{
Mednafen::MDFNGameInfo = &EmulatedSNES_Faust;
}
// ECL_EXPORT bool GetSaveRam()
// {
// try
// {
// FLASH_SaveNV();
// return true;
// }
// catch(...)
// {
// return false;
// }
// }
// ECL_EXPORT bool PutSaveRam()
// {
// try
// {
// FLASH_LoadNV();
// return true;
// }
// catch(...)
// {
// return false;
// }
// }
// namespace MDFN_IEN_NGP
// {
// extern uint8 CPUExRAM[16384];
// }
#define MemoryDomainFunctions(N,R,W)\
static void Access##N(uint8_t* buffer, int64_t address, int64_t count, bool write)\
{\
if (write)\
{\
while (count--)\
W(address++, *buffer++);\
}\
else\
{\
while (count--)\
*buffer++ = R(address++);\
}\
}
MemoryDomainFunctions(WRAM, PeekWRAM, PokeWRAM);
ECL_EXPORT void GetMemoryAreas(MemoryArea* m)
{
int i = 0;
// m[0].Data = Memory.SRAM; // sram, or sufami A sram
// m[0].Name = "CARTRAM";
// m[0].Size = (unsigned)(Memory.SRAMSize ? (1 << (Memory.SRAMSize + 3)) * 128 : 0);
// if (m[0].Size > 0x20000)
// m[0].Size = 0x20000;
// m[0].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE2 | MEMORYAREA_FLAGS_SAVERAMMABLE;
// m[1].Data = Multi.sramB; // sufami B sram
// m[1].Name = "CARTRAM B";
// m[1].Size = (unsigned)(Multi.cartType && Multi.sramSizeB ? (1 << (Multi.sramSizeB + 3)) * 128 : 0);
// m[1].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE2 | MEMORYAREA_FLAGS_SAVERAMMABLE;
// m[2].Data = RTCData.reg;
// m[2].Name = "RTC";
// m[2].Size = (Settings.SRTC || Settings.SPC7110RTC) ? 20 : 0;
// m[2].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE1 | MEMORYAREA_FLAGS_SAVERAMMABLE;
m[i].Data = (void*)(MemoryFunctionHook)AccessWRAM;
m[i].Name = "WRAM";
m[i].Size = 128 * 1024;
m[i].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE2 | MEMORYAREA_FLAGS_PRIMARY | MEMORYAREA_FLAGS_FUNCTIONHOOK;
i++;
// m[4].Data = Memory.VRAM;
// m[4].Name = "VRAM";
// m[4].Size = 64 * 1024;
// m[4].Flags = MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE2;
// m[5].Data = Memory.ROM;
// m[5].Name = "CARTROM";
// m[5].Size = Memory.CalculatedSize;
// m[5].Flags = MEMORYAREA_FLAGS_WORDSIZE2;
}
// stub ppu_mt since we can't support it
namespace MDFN_IEN_SNES_FAUST
{
static MDFN_COLD uint32 DummyEventHandler(uint32 timestamp)
{
return SNES_EVENT_MAXTS;
}
namespace PPU_MT
{
void PPU_Init(const bool IsPAL, const bool IsPALPPUBit, const bool WantFrameBeginVBlank, const uint64 affinity){}
void PPU_SetGetVideoParams(MDFNGI* gi, const unsigned caspect, const unsigned hfilter, const unsigned sls, const unsigned sle){}
snes_event_handler PPU_GetEventHandler(void){ return DummyEventHandler; }
snes_event_handler PPU_GetLineIRQEventHandler(void){ return DummyEventHandler; }
void PPU_Kill(void){}
void PPU_StartFrame(EmulateSpecStruct* espec){}
void PPU_SyncMT(void){}
void PPU_Reset(bool powering_up){}
void PPU_ResetTS(void){}
void PPU_StateAction(StateMem* sm, const unsigned load, const bool data_only){}
uint16 PPU_PeekVRAM(uint32 addr){ return 0; }
uint16 PPU_PeekCGRAM(uint32 addr){ return 0; }
uint8 PPU_PeekOAM(uint32 addr){ return 0; }
uint8 PPU_PeekOAMHI(uint32 addr){ return 0; }
uint32 PPU_GetRegister(const unsigned id, char* const special, const uint32 special_len){ return 0; }
}
// and msu1 because it uses MT readers
void MSU1_Init(GameFile* gf, double* IdealSoundRate, uint64 affinity_audio, uint64 affinity_data){}
void MSU1_Kill(void){}
void MSU1_Reset(bool powering_up){}
void MSU1_StateAction(StateMem* sm, const unsigned load, const bool data_only){}
void MSU1_StartFrame(double master_clock, double rate, int32 apu_clock_multiplier, int32 resamp_num, int32 resamp_denom, bool resamp_clear_buf){}
void MSU1_EndFrame(int16* SoundBuf, int32 SoundBufSize){}
void MSU1_AdjustTS(const int32 delta){}
snes_event_handler MSU1_GetEventHandler(void){ return DummyEventHandler; }
}

10
waterbox/nyma/faust.mak Normal file
View File

@ -0,0 +1,10 @@
include common.mak
SRCS += \
$(filter-out %ppu_mt.cpp %ppu_mtrender.cpp %msu1.cpp,$(call cppdir,snes_faust)) \
mednafen/src/cheat_formats/snes.cpp \
mednafen/src/SNSFLoader.cpp mednafen/src/PSFLoader.cpp mednafen/src/SPCReader.cpp \
cdrom_dummy.cpp \
faust.cpp
include ../common.mak

View File

@ -17,7 +17,7 @@ void SetupMDFNGameInfo()
Mednafen::MDFNGameInfo = &EmulatedPCE;
}
#define DEFUN(N,R,W)\
#define MemoryDomainFunctions(N,R,W)\
static void Access##N(uint8_t* buffer, int64_t address, int64_t count, bool write)\
{\
PCE_InDebug = 1;\
@ -33,7 +33,7 @@ static void Access##N(uint8_t* buffer, int64_t address, int64_t count, bool writ
}\
PCE_InDebug = 0;\
}
#define DEFRG(N,R,W)\
#define MemoryDomainBulkFunctions(N,R,W)\
static void Access##N(uint8_t* buffer, int64_t address, int64_t count, bool write)\
{\
PCE_InDebug = 1;\
@ -62,10 +62,10 @@ namespace MDFN_IEN_PCE
}
}
DEFUN(ShortBus, HuCPU.PeekLogical, HuCPU.PokeLogical);
DEFUN(LongBus, HuCPU.PeekPhysical, HuCPU.PokePhysical);
DEFUN(BRAM, HuC_PeekBRAM, HuC_PokeBRAM);
DEFRG(ADPCM, ADPCM_PeekRAM, ADPCM_PokeRAM);
MemoryDomainFunctions(ShortBus, HuCPU.PeekLogical, HuCPU.PokeLogical);
MemoryDomainFunctions(LongBus, HuCPU.PeekPhysical, HuCPU.PokePhysical);
MemoryDomainFunctions(BRAM, HuC_PeekBRAM, HuC_PokeBRAM);
MemoryDomainBulkFunctions(ADPCM, ADPCM_PeekRAM, ADPCM_PokeRAM);
ECL_EXPORT void GetMemoryAreas(MemoryArea* m)
{