Skip to content
This repository has been archived by the owner on Sep 11, 2023. It is now read-only.

n163: Account for battery flag when initializing internal ram #147

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Core/Namco163.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class Namco163 : public BaseMapper
void InitMapper() override
{
_audio.reset(new Namco163Audio(_console));
_audio->InitializeInternalRam(HasBattery());

switch(_romInfo.MapperID) {
case 19:
Expand Down
10 changes: 9 additions & 1 deletion Core/Namco163Audio.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class Namco163Audio : public BaseExpansionAudio
public:
Namco163Audio(shared_ptr<Console> console) : BaseExpansionAudio(console)
{
_console->InitializeRam(_internalRam, sizeof(_internalRam));
memset(_internalRam, 0, sizeof(_internalRam));
memset(_channelOutput, 0, sizeof(_channelOutput));
_ramPosition = 0;
_autoIncrement = false;
Expand All @@ -154,6 +154,14 @@ class Namco163Audio : public BaseExpansionAudio
_disableSound = false;
}

void InitializeInternalRam(bool hasBattery)
{
if (!hasBattery)
{
_console->InitializeRam(_internalRam, sizeof(_internalRam));
}
}

uint8_t* GetInternalRam()
{
return _internalRam;
Expand Down