Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
audetto committed Dec 31, 2021
2 parents 8984232 + a243efc commit b48893f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 18 deletions.
5 changes: 1 addition & 4 deletions source/CmdLine.cpp
Expand Up @@ -37,8 +37,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Joystick.h"
#include "SoundCore.h"
#include "ParallelPrinter.h"
#include "CardManager.h"
#include "SerialComms.h"
#include "Interface.h"

CmdLine g_cmdLine;
Expand Down Expand Up @@ -408,8 +406,7 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
}
else if ((strcmp(lpCmdLine, "-dcd") == 0) || (strcmp(lpCmdLine, "-modem") == 0)) // GH#386
{
if (GetCardMgr().IsSSCInstalled())
GetCardMgr().GetSSC()->SupportDCD(true);
g_cmdLine.supportDCD = true;
}
else if (strcmp(lpCmdLine, "-alt-enter=toggle-full-screen") == 0) // GH#556
{
Expand Down
2 changes: 2 additions & 0 deletions source/CmdLine.h
Expand Up @@ -20,6 +20,7 @@ struct CmdLine
bRemoveNoSlotClock = false;
snesMaxAltControllerType[0] = false;
snesMaxAltControllerType[1] = false;
supportDCD = false;
szImageName_harddisk[HARDDISK_1] = NULL;
szImageName_harddisk[HARDDISK_2] = NULL;
szSnapshotName = NULL;
Expand Down Expand Up @@ -59,6 +60,7 @@ struct CmdLine
bool bSwapButtons0and1;
bool bRemoveNoSlotClock;
bool snesMaxAltControllerType[2];
bool supportDCD;
SS_CARDTYPE slotInsert[NUM_SLOTS];
LPCSTR szImageName_drive[NUM_SLOTS][NUM_DRIVES];
bool driveConnected[NUM_SLOTS][NUM_DRIVES];
Expand Down
37 changes: 31 additions & 6 deletions source/Memory.cpp
Expand Up @@ -1731,22 +1731,45 @@ void MemInitializeIO(void)

// Called by:
// . Snapshot_LoadState_v2()
void MemInitializeCardSlotAndExpansionRomFromSnapshot(void)
void MemInitializeFromSnapshot(void)
{
MemInitializeROM();
MemInitializeCustomROM();
MemInitializeCustomF8ROM();
MemInitializeIO();

//
// Card and Expansion ROM
//

// Remove all the cards' ROMs at $Csnn if internal ROM is enabled
if (IsAppleIIeOrAbove(GetApple2Type()) && SW_INTCXROM)
IoHandlerCardsOut();

// Potentially init a card's expansion ROM
const UINT uSlot = g_uPeripheralRomSlot;

if (ExpansionRom[uSlot] == NULL)
return;
if (ExpansionRom[uSlot] != NULL)
{
_ASSERT(g_eExpansionRomType == eExpRomPeripheral);

_ASSERT(g_eExpansionRomType == eExpRomPeripheral);
memcpy(pCxRomPeripheral + 0x800, ExpansionRom[uSlot], FIRMWARE_EXPANSION_SIZE);
// NB. Copied to /mem/ by UpdatePaging(TRUE)
}

MemUpdatePaging(TRUE);

//
// VidHD
//

memcpy(pCxRomPeripheral+0x800, ExpansionRom[uSlot], FIRMWARE_EXPANSION_SIZE);
// NB. Copied to /mem/ by UpdatePaging(TRUE)
memVidHD = NULL;

if (IsApple2PlusOrClone(GetApple2Type()) && (GetCardMgr().QuerySlot(SLOT3) == CT_VidHD))
{
VidHDCard* vidHD = dynamic_cast<VidHDCard*>(GetCardMgr().GetObj(SLOT3));
memVidHD = vidHD->IsWriteAux() ? memaux : NULL;
}
}

inline DWORD getRandomTime()
Expand Down Expand Up @@ -1778,6 +1801,8 @@ void MemReset()

memset(memdirty, 0, 0x100);

memVidHD = NULL;

//

int iByte;
Expand Down
2 changes: 1 addition & 1 deletion source/Memory.h
Expand Up @@ -84,7 +84,7 @@ void MemInitializeROM(void);
void MemInitializeCustomROM(void);
void MemInitializeCustomF8ROM(void);
void MemInitializeIO(void);
void MemInitializeCardSlotAndExpansionRomFromSnapshot(void);
void MemInitializeFromSnapshot(void);
BYTE MemReadFloatingBus(const ULONG uExecutedCycles);
BYTE MemReadFloatingBus(const BYTE highbit, const ULONG uExecutedCycles);
void MemReset ();
Expand Down
8 changes: 1 addition & 7 deletions source/SaveState.cpp
Expand Up @@ -499,13 +499,7 @@ static void Snapshot_LoadState_v2(void)
const CConfigNeedingRestart configNew = CConfigNeedingRestart::Create();
GetPropertySheet().ApplyNewConfigFromSnapshot(configNew); // Saves new state to Registry (not slot/cards though)

MemInitializeROM();
MemInitializeCustomROM();
MemInitializeCustomF8ROM();
MemInitializeIO();
MemInitializeCardSlotAndExpansionRomFromSnapshot();

MemUpdatePaging(TRUE);
MemInitializeFromSnapshot();

DebugReset();
if (g_nAppMode == MODE_DEBUG)
Expand Down
7 changes: 7 additions & 0 deletions source/Windows/AppleWin.cpp
Expand Up @@ -42,6 +42,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "Registry.h"
#include "Riff.h"
#include "SaveState.h"
#include "SerialComms.h"
#include "SoundCore.h"
#include "Speaker.h"
#include "LanguageCard.h"
Expand Down Expand Up @@ -670,6 +671,7 @@ static void RepeatInitialization(void)
// NB. g_OldAppleWinVersion needed by LoadConfiguration() -> Config_Load_Video()
const bool bShowAboutDlg = CheckOldAppleWinVersion(); // Post: g_OldAppleWinVersion

// Load configuration from Registry
{
bool loadImages = g_cmdLine.szSnapshotName == NULL; // don't load floppy/harddisk images if a snapshot is to be loaded later on
LoadConfiguration(loadImages);
Expand Down Expand Up @@ -747,6 +749,11 @@ static void RepeatInitialization(void)
if (g_cmdLine.bSlotEmpty[SLOT6])
GetCardMgr().Remove(SLOT6);

if (g_cmdLine.supportDCD && GetCardMgr().IsSSCInstalled())
{
GetCardMgr().GetSSC()->SupportDCD(true);
}

if (g_cmdLine.slotInsert[SLOT3] != CT_Empty && g_cmdLine.slotInsert[SLOT3] == CT_VidHD) // For now just support VidHD in slot 3
{
GetCardMgr().Insert(SLOT3, g_cmdLine.slotInsert[SLOT3]);
Expand Down

0 comments on commit b48893f

Please sign in to comment.