Skip to content

Commit

Permalink
Add support for ST-V (with Saturnus)
Browse files Browse the repository at this point in the history
  • Loading branch information
CasualPokePlayer committed Nov 15, 2024
1 parent 9fe5b31 commit a51c7c0
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 4 deletions.
Binary file modified Assets/dll/faust.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/hyper.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/ngp.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/pcfx.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/shock.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/ss.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/turbo.wbx.zst
Binary file not shown.
Binary file modified Assets/dll/vb.wbx.zst
Binary file not shown.
4 changes: 3 additions & 1 deletion waterbox/nyma/NymaCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ ECL_EXPORT void FrameAdvance(MyFrameInfo& frame)

if (frame.Command)
Game->DoSimpleCommand(frame.Command);

memcpy(InputPortData, frame.InputPortData, sizeof(InputPortData));

if (Game->TransformInput)
Expand Down Expand Up @@ -254,6 +254,7 @@ struct SystemInfo
int32_t NominalWidth;
int32_t NominalHeight;
int32_t VideoSystem;
int32_t GameType;
int32_t FpsFixed;
int64_t MasterClock;
int32_t LcmWidth;
Expand All @@ -272,6 +273,7 @@ ECL_EXPORT SystemInfo* GetSystemInfo()
SI.NominalWidth = Game->nominal_width;
SI.NominalHeight = Game->nominal_height;
SI.VideoSystem = Game->VideoSystem;
SI.GameType = Game->GameType;
SI.FpsFixed = Game->fps;
SI.MasterClock = Game->MasterClock;
SI.LcmWidth = Game->lcm_width;
Expand Down
2 changes: 1 addition & 1 deletion waterbox/nyma/mednafen
31 changes: 29 additions & 2 deletions waterbox/nyma/ss.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "nyma.h"
#include <emulibc.h>
#include <waterboxcore.h>
#include <src/ss/ak93c45.h>
#include <src/ss/cart.h>
#include <src/ss/smpc.h>
namespace MDFN_IEN_SS
Expand Down Expand Up @@ -42,6 +43,8 @@ namespace MDFN_IEN_SS
extern uint16* CS1RAM;
extern uint16 ExtRAM[0x200000];
extern uint16 ROM[0x100000];
extern uint16 STV_ROM[0x3000000 / sizeof(uint16)];
extern AK93C45 eep;

extern int ActiveCartType;

Expand Down Expand Up @@ -72,6 +75,9 @@ ECL_EXPORT uint32_t GetSaveRamLength()
if (ActiveCartType == CART_BACKUP_MEM)
return sizeof(BackupRAM) + sizeof(ExtBackupRAM) + sizeof(uint8_t) + sizeof(RTC.raw) + sizeof(SaveMem);

if (ActiveCartType == CART_STV)
return sizeof(BackupRAM) + sizeof(eep.mem) + sizeof(uint8_t) + sizeof(RTC.raw) + sizeof(SaveMem);

return sizeof(BackupRAM) + sizeof(uint8_t) + sizeof(RTC.raw) + sizeof(SaveMem);
}

Expand All @@ -86,6 +92,12 @@ ECL_EXPORT void GetSaveRam(uint8_t* data)
data += sizeof(ExtBackupRAM);
}

if (ActiveCartType == CART_STV)
{
memcpy(data, eep.mem, sizeof(eep.mem));
data += sizeof(eep.mem);
}

*data = RTC.Valid;
data += sizeof(uint8_t);

Expand Down Expand Up @@ -114,6 +126,16 @@ ECL_EXPORT void PutSaveRam(uint8_t* data, uint32_t length)
}
}

if (ActiveCartType == CART_STV)
{
if (length >= sizeof(eep.mem))
{
memcpy(eep.mem, data, sizeof(eep.mem));
data += sizeof(eep.mem);
length -= sizeof(eep.mem);
}
}

if (length >= (sizeof(uint8_t) + sizeof(RTC.raw) + sizeof(SaveMem)))
{
RTC.Valid = *data != 0;
Expand Down Expand Up @@ -144,7 +166,7 @@ ECL_EXPORT void GetMemoryAreas(MemoryArea* m)
while (0)
AddMemoryDomain("Sound Ram", SCSP.GetRAMPtr(), 0x100000, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Backup Ram", BackupRAM, sizeof(BackupRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Boot Rom", BIOSROM, 524288, MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Boot Rom", BIOSROM, 524288, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Work Ram Low", WorkRAML, sizeof(WorkRAML), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Work Ram High", WorkRAMH, sizeof(WorkRAMH), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2 | MEMORYAREA_FLAGS_PRIMARY);
AddMemoryDomain("VDP1 Ram", VDP1::VRAM, sizeof(VDP1::VRAM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
Expand All @@ -160,7 +182,12 @@ ECL_EXPORT void GetMemoryAreas(MemoryArea* m)
if (ActiveCartType == CART_EXTRAM_1M)
AddMemoryDomain("Ram Cart", ExtRAM, sizeof(ExtRAM) / 4, MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
if (ActiveCartType == CART_KOF95 || ActiveCartType == CART_ULTRAMAN)
AddMemoryDomain("Rom Cart", ROM, sizeof(ROM), MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("Rom Cart", ROM, sizeof(ROM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
if (ActiveCartType == CART_STV)
{
AddMemoryDomain("Rom Cart", STV_ROM, sizeof(STV_ROM), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
AddMemoryDomain("STV EEPROM", eep.mem, sizeof(eep.mem), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_SWAPPED | MEMORYAREA_FLAGS_YUGEENDIAN | MEMORYAREA_FLAGS_WORDSIZE2);
}
AddMemoryDomain("SMPC RTC", RTC.raw, sizeof(RTC.raw), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE1);
AddMemoryDomain("SMPC SaveMem", SaveMem, sizeof(SaveMem), MEMORYAREA_FLAGS_WRITABLE | MEMORYAREA_FLAGS_WORDSIZE1);
}

0 comments on commit a51c7c0

Please sign in to comment.