diff --git a/help/CommandLine.html b/help/CommandLine.html index 68e3294a..1c09c7b2 100644 --- a/help/CommandLine.html +++ b/help/CommandLine.html @@ -64,15 +64,18 @@ -load-state <savestate>
Load a save-state file (and auto power-on the Apple II).
NB. This takes precedent over the -d1, -d2, -s#d#, -h1, -h2, s0-7, -model and -r switches.

- -f
- Start in full-screen mode

+ -f or -full-screen
+ Start in full-screen mode.

+ -no-full-screen
+ Start in Windowed mode (default).

-fs-height=<best|nnnn>
- Use to select a better resolution for full-screen mode.
+ Use to select a better resolution for full-screen or Windowed mode.
- NB. This changes the display resolution (and restores on exit).

+ NB. This changes the display resolution (and restores on exit).
+ NB. Specify -no-full-screen after this switch for Windowed mode. Without this it'll just default to full-screen.

-rom <file>
Use custom 12K ROM (at $D000) for Apple II machine, or 16K ROM (at $C000) for Apple //e machine.

-f8rom <file>
diff --git a/source/CmdLine.cpp b/source/CmdLine.cpp index 416e8051..37c370fc 100644 --- a/source/CmdLine.cpp +++ b/source/CmdLine.cpp @@ -189,14 +189,18 @@ bool ProcessCmdLine(LPSTR lpCmdLine) lpNextArg = GetNextArg(lpNextArg); g_cmdLine.szSnapshotName = lpCmdLine; } - else if (strcmp(lpCmdLine, "-f") == 0) + else if (strcmp(lpCmdLine, "-f") == 0 || strcmp(lpCmdLine, "-full-screen") == 0) { g_cmdLine.bSetFullScreen = true; } + else if (strcmp(lpCmdLine, "-no-full-screen") == 0) + { + g_cmdLine.bSetFullScreen = false; + } #define CMD_FS_HEIGHT "-fs-height=" else if (strncmp(lpCmdLine, CMD_FS_HEIGHT, sizeof(CMD_FS_HEIGHT)-1) == 0) { - g_cmdLine.bSetFullScreen = true; // Implied + g_cmdLine.bSetFullScreen = true; // Implied. Can be overridden by "-no-full-screen" LPSTR lpTmp = lpCmdLine + sizeof(CMD_FS_HEIGHT)-1; bool bRes = false; diff --git a/source/DiskImageHelper.cpp b/source/DiskImageHelper.cpp index 66f3c061..f7778343 100644 --- a/source/DiskImageHelper.cpp +++ b/source/DiskImageHelper.cpp @@ -554,7 +554,7 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd *(imageptr++) = 0xD5; *(imageptr++) = 0xAA; *(imageptr++) = 0xAD; - CopyMemory(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343); + memcpy(imageptr, Code62(ms_SectorNumber[SectorOrder][sector]), 343); imageptr += 343; *(imageptr++) = 0xDE; *(imageptr++) = 0xAA; @@ -575,9 +575,9 @@ DWORD CImageBase::NibblizeTrack(LPBYTE trackimagebuffer, SectorOrder_e SectorOrd void CImageBase::SkewTrack(const int nTrack, const int nNumNibbles, const LPBYTE pTrackImageBuffer) { int nSkewBytes = (nTrack*768) % nNumNibbles; - CopyMemory(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles); - CopyMemory(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes); - CopyMemory(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes); + memcpy(m_pWorkBuffer, pTrackImageBuffer, nNumNibbles); + memcpy(pTrackImageBuffer, m_pWorkBuffer+nSkewBytes, nNumNibbles-nSkewBytes); + memcpy(pTrackImageBuffer+nNumNibbles-nSkewBytes, m_pWorkBuffer, nSkewBytes); } //------------------------------------- diff --git a/source/Harddisk.cpp b/source/Harddisk.cpp index 6b3a7067..3bc27345 100644 --- a/source/Harddisk.cpp +++ b/source/Harddisk.cpp @@ -597,7 +597,7 @@ static BYTE __stdcall HD_IO_EMUL(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG } } - MoveMemory(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE); + memmove(pHDD->hd_buf, mem+pHDD->hd_memblock, HD_BLOCK_SIZE); if (bRes) bRes = ImageWriteBlock(pHDD->imagehandle, pHDD->hd_diskblock, pHDD->hd_buf); diff --git a/source/Memory.cpp b/source/Memory.cpp index 7dd4e556..9c222f9d 100644 --- a/source/Memory.cpp +++ b/source/Memory.cpp @@ -1132,7 +1132,7 @@ static void UpdatePaging(BOOL initialize) // SAVE THE CURRENT PAGING SHADOW TABLE LPBYTE oldshadow[256]; if (!initialize) - CopyMemory(oldshadow,memshadow,256*sizeof(LPBYTE)); + memcpy(oldshadow,memshadow,256*sizeof(LPBYTE)); // UPDATE THE PAGING TABLES BASED ON THE NEW PAGING SWITCH VALUES UINT loop; @@ -1245,10 +1245,10 @@ static void UpdatePaging(BOOL initialize) ((*(memdirty+loop) & 1) || (loop <= 1))) { *(memdirty+loop) &= ~1; - CopyMemory(oldshadow[loop],mem+(loop << 8),256); + memcpy(oldshadow[loop],mem+(loop << 8),256); } - CopyMemory(mem+(loop << 8),memshadow[loop],256); + memcpy(mem+(loop << 8),memshadow[loop],256); } } } @@ -1320,7 +1320,7 @@ static void BackMainImage(void) for (UINT loop = 0; loop < 256; loop++) { if (memshadow[loop] && ((*(memdirty+loop) & 1) || (loop <= 1))) - CopyMemory(memshadow[loop], mem+(loop << 8), 256); + memcpy(memshadow[loop], mem+(loop << 8), 256); *(memdirty+loop) &= ~1; } diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 0f6daa0a..5c3dd19d 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -1649,6 +1649,9 @@ void MB_Destroy() for (int id=0; idm_active) + g_SynchronousEventMgr.Remove(id); + delete g_syncEvent[id]; g_syncEvent[id] = NULL; } diff --git a/source/MouseInterface.h b/source/MouseInterface.h index 6b142d1a..38168d0c 100644 --- a/source/MouseInterface.h +++ b/source/MouseInterface.h @@ -17,6 +17,7 @@ public: void Initialize(LPBYTE pCxRomPeripheral, UINT uSlot); // void Uninitialize(); void Reset(); + UINT GetSlot(void) { return m_uSlot; } static BYTE __stdcall IORead(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles); static BYTE __stdcall IOWrite(WORD PC, WORD uAddr, BYTE bWrite, BYTE uValue, ULONG nExecutedCycles); diff --git a/source/NTSC.cpp b/source/NTSC.cpp index d0760a5f..7e7a7791 100644 --- a/source/NTSC.cpp +++ b/source/NTSC.cpp @@ -31,6 +31,9 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "NTSC_CharSet.h" +// Some reference material here from 2000: +// http://www.kreativekorp.com/miscpages/a2info/munafo.shtml +// #define NTSC_REMOVE_WHITE_RINGING 1 // 0 = theoritical dimmed white has chroma, 1 = pure white without chroma tinting #define NTSC_REMOVE_BLACK_GHOSTING 1 // 1 = remove black smear/smudges carrying over @@ -64,47 +67,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //#define CYCLESTART (PI/4.f) // PI/4 = 45 degrees #define CYCLESTART (DEG_TO_RAD(45)) -// Types - - struct ColorSpace_PAL_t // Phase Amplitute Luma - { - float phase; - float amp; - float luma; - }; - - struct ColorSpace_YIQ_t - { - float y, i, q; - }; - - struct rgba_t - { - uint8_t r; - uint8_t g; - uint8_t b; - uint8_t a; - }; - - struct abgr_t - { - uint8_t a; - uint8_t b; - uint8_t g; - uint8_t r; - }; - - struct ColorSpace_BGRA_t - { - union - { - uint32_t n; - bgra_t bgra; - rgba_t rgba; - abgr_t abgr; - }; - }; - // Globals (Public) ___________________________________________________ uint16_t g_nVideoClockVert = 0; // 9-bit: VC VB VA V5 V4 V3 V2 V1 V0 = 0 .. 262 @@ -345,62 +307,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA }; #endif - /* - http://www.kreativekorp.com/miscpages/a2info/munafo.shtml - - "Primary" lo-res colors - Color GR Duty cycle Phase - ====================================== - Red COLOR=1 45 to 135 90 - Dark-blue COLOR=2 315 to 45 0 - Dark-green COLOR=4 225 to 315 270 - Brown COLOR=8 135 to 225 180 - */ - ColorSpace_PAL_t aPaletteYIQ[ 16 ] = - { // Lo Hi Dh - { 0, 0, 0 } // 0 0 Black - ,{ 90, 60, 25 } // 1 1 Red - ,{ 0, 60, 25 } // 2 8 Dark Blue - ,{ 45,100, 50 } // 3 2 9 Purple - ,{270, 60, 25 } // 4 Dark Green - ,{ 0, 0, 50 } // 5 Grey - ,{315,100, 50 } // 6 Medium Blue - ,{ 0, 60, 75 } // 7 Light Blue - ,{180, 60, 25 } // 8 Brown - ,{135,100, 50 } // 9 Orange - ,{ 0, 0, 50 } // 10 - ,{ 90, 60, 75 } // 11 Pink - ,{225,100, 50 } // 12 Light Green - ,{180, 60, 75 } // 13 Yellow - ,{270, 60, 75} // 14 Aqua - ,{ 0, 0,100 } // 15 White - }; - -// purple HCOLOR=2 45 100 50 255 68 253 -// orange HCOLOR=5 135 100 50 255 106 60 -// green HCOLOR=1 225 100 50 20 245 60 -// blue HCOLOR=6 315 100 50 20 207 253 - - rgba_t aPaletteRGB[ 16 ] = - { - { 0, 0, 0 } // 0 - ,{ 227, 30, 96 } // 1 - ,{ 96, 78, 189 } // 2 - ,{ 255, 68, 253 } // 3 - ,{ 0, 163, 96 } // 4 - ,{ 156, 156, 156 } // 5 - ,{ 20, 207, 253 } // 6 - ,{ 208, 195, 255 } // 7 - ,{ 96, 114, 3 } // 8 - ,{ 255, 106, 60 } // 9 - ,{ 156, 156, 156 } // 10 - ,{ 255, 160, 208 } // 11 - ,{ 20, 245, 60 } // 12 - ,{ 208, 221, 141 } // 13 - ,{ 114, 255, 208 } // 14 - ,{ 255, 255, 255 } // 15 - }; - static csbits_t csbits; // charset, optionally followed by alt charset // Prototypes diff --git a/source/Windows/AppleWin.cpp b/source/Windows/AppleWin.cpp index a8c52ebe..151c6688 100644 --- a/source/Windows/AppleWin.cpp +++ b/source/Windows/AppleWin.cpp @@ -653,19 +653,23 @@ int APIENTRY WinMain(HINSTANCE passinstance, HINSTANCE, LPSTR lpCmdLine, int) MB_Reset(); LogFileOutput("Main: MB_Reset()\n"); - CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard(); - if (pMouseCard) + if (g_bRestart) { - pMouseCard->Reset(); // Deassert any pending IRQs - GH#514 - LogFileOutput("Main: CMouseInterface::Uninitialize()\n"); + CMouseInterface* pMouseCard = GetCardMgr().GetMouseCard(); + if (pMouseCard) + { + // dtor removes event from g_SynchronousEventMgr - do before g_SynchronousEventMgr.Reset() + GetCardMgr().Remove( pMouseCard->GetSlot() ); + LogFileOutput("Main: CMouseInterface::dtor\n"); + } + + _ASSERT(g_SynchronousEventMgr.GetHead() == NULL); + g_SynchronousEventMgr.Reset(); } DSUninit(); LogFileOutput("Main: DSUninit()\n"); - if (g_bRestart) - g_SynchronousEventMgr.Reset(); - if (g_bHookSystemKey) { UninitHookThread(); @@ -985,23 +989,23 @@ static void RepeatInitialization(void) } else { + if (g_cmdLine.bestWidth && g_cmdLine.bestHeight) + { + DEVMODE devMode; + memset(&devMode, 0, sizeof(devMode)); + devMode.dmSize = sizeof(devMode); + devMode.dmPelsWidth = g_cmdLine.bestWidth; + devMode.dmPelsHeight = g_cmdLine.bestHeight; + devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; + + DWORD dwFlags = 0; + LONG res = ChangeDisplaySettings(&devMode, dwFlags); + if (res == 0) + g_cmdLine.bChangedDisplayResolution = true; + } + if (g_cmdLine.bSetFullScreen) { - if (g_cmdLine.bestWidth && g_cmdLine.bestHeight) - { - DEVMODE devMode; - memset(&devMode, 0, sizeof(devMode)); - devMode.dmSize = sizeof(devMode); - devMode.dmPelsWidth = g_cmdLine.bestWidth; - devMode.dmPelsHeight = g_cmdLine.bestHeight; - devMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT; - - DWORD dwFlags = 0; - LONG res = ChangeDisplaySettings(&devMode, dwFlags); - if (res == 0) - g_cmdLine.bChangedDisplayResolution = true; - } - PostMessage(g_hFrameWindow, WM_USER_FULLSCREEN, 0, 0); g_cmdLine.bSetFullScreen = false; } diff --git a/source/Windows/WinVideo.cpp b/source/Windows/WinVideo.cpp index c0d4e86e..a6152530 100644 --- a/source/Windows/WinVideo.cpp +++ b/source/Windows/WinVideo.cpp @@ -151,7 +151,7 @@ void VideoBenchmark () { DWORD totaltextfps = 0; g_uVideoMode = VF_TEXT; - FillMemory(mem+0x400,0x400,0x14); + memset(mem+0x400,0x14,0x400); VideoRedrawScreen(); DWORD milliseconds = GetTickCount(); while (GetTickCount() == milliseconds) ; @@ -159,9 +159,9 @@ void VideoBenchmark () { DWORD cycle = 0; do { if (cycle & 1) - FillMemory(mem+0x400,0x400,0x14); + memset(mem+0x400,0x14,0x400); else - CopyMemory(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400); + memcpy(mem+0x400,mem+((cycle & 2) ? 0x4000 : 0x6000),0x400); VideoRefreshScreen(); if (cycle++ >= 3) cycle = 0; @@ -173,7 +173,7 @@ void VideoBenchmark () { // SIMULATE THE ACTIVITY OF AN AVERAGE GAME DWORD totalhiresfps = 0; g_uVideoMode = VF_HIRES; - FillMemory(mem+0x2000,0x2000,0x14); + memset(mem+0x2000,0x14,0x2000); VideoRedrawScreen(); milliseconds = GetTickCount(); while (GetTickCount() == milliseconds) ; @@ -181,9 +181,9 @@ void VideoBenchmark () { cycle = 0; do { if (cycle & 1) - FillMemory(mem+0x2000,0x2000,0x14); + memset(mem+0x2000,0x14,0x2000); else - CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000); + memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000); VideoRefreshScreen(); if (cycle++ >= 3) cycle = 0; @@ -257,7 +257,7 @@ void VideoBenchmark () { // WITH FULL EMULATION OF THE CPU, JOYSTICK, AND DISK HAPPENING AT // THE SAME TIME DWORD realisticfps = 0; - FillMemory(mem+0x2000,0x2000,0xAA); + memset(mem+0x2000,0xAA,0x2000); VideoRedrawScreen(); milliseconds = GetTickCount(); while (GetTickCount() == milliseconds) ; @@ -274,9 +274,9 @@ void VideoBenchmark () { } } if (cycle & 1) - FillMemory(mem+0x2000,0x2000,0xAA); + memset(mem+0x2000,0xAA,0x2000); else - CopyMemory(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000); + memcpy(mem+0x2000,mem+((cycle & 2) ? 0x4000 : 0x6000),0x2000); VideoRedrawScreen(); if (cycle++ >= 3) cycle = 0; diff --git a/source/linux/benchmark.cpp b/source/linux/benchmark.cpp index bcb94fbc..82db52aa 100644 --- a/source/linux/benchmark.cpp +++ b/source/linux/benchmark.cpp @@ -31,7 +31,7 @@ void VideoBenchmark(std::function redraw, std::function refresh) // GOING ON, CHANGING HALF OF THE BYTES IN THE VIDEO BUFFER EACH FRAME TO // SIMULATE THE ACTIVITY OF AN AVERAGE GAME g_uVideoMode = VF_HIRES; - FillMemory(mem+0x2000,0x2000,0x14); + memset(mem+0x2000,0x14,0x2000); redraw(); typedef std::chrono::microseconds interval_t; @@ -43,9 +43,9 @@ void VideoBenchmark(std::function redraw, std::function refresh) auto start = std::chrono::steady_clock::now(); do { if (totalhiresfps & 1) - FillMemory(mem+0x2000,0x2000,0x14); + memset(mem+0x2000,0x14,0x2000); else - CopyMemory(mem+0x2000,mem+((totalhiresfps & 2) ? 0x4000 : 0x6000),0x2000); + memcpy(mem+0x2000,mem+((totalhiresfps & 2) ? 0x4000 : 0x6000),0x2000); refresh(); totalhiresfps++; @@ -123,7 +123,7 @@ void VideoBenchmark(std::function redraw, std::function refresh) // WITH FULL EMULATION OF THE CPU, JOYSTICK, AND DISK HAPPENING AT // THE SAME TIME counter_t realisticfps = 0; - FillMemory(mem+0x2000,0x2000,0xAA); + memset(mem+0x2000,0xAA,0x2000); redraw(); const size_t dwClksPerFrame = NTSC_GetCyclesPerFrame(); @@ -145,9 +145,9 @@ void VideoBenchmark(std::function redraw, std::function refresh) { cyclesThisFrame -= dwClksPerFrame; if (realisticfps & 1) - FillMemory(mem+0x2000,0x2000,0xAA); + memset(mem+0x2000,0xAA,0x2000); else - CopyMemory(mem+0x2000,mem+((realisticfps & 2) ? 0x4000 : 0x6000),0x2000); + memcpy(mem+0x2000,mem+((realisticfps & 2) ? 0x4000 : 0x6000),0x2000); realisticfps++; refresh(); } diff --git a/source/linux/win.h b/source/linux/win.h index b4e002df..3d60cf16 100644 --- a/source/linux/win.h +++ b/source/linux/win.h @@ -2,7 +2,6 @@ #include "linux/windows/wincompat.h" #include "linux/windows/guiddef.h" -#include "linux/windows/memory.h" #include "linux/windows/handles.h" #include "linux/windows/bitmap.h" #include "linux/windows/files.h" diff --git a/source/linux/windows/memory.cpp b/source/linux/windows/memory.cpp deleted file mode 100644 index cc690656..00000000 --- a/source/linux/windows/memory.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include "linux/windows/memory.h" -#include - -LPVOID VirtualAlloc(LPVOID lpAddress, size_t dwSize, - DWORD flAllocationType, DWORD flProtect) { - /* just malloc and alles? 0_0 */ - void* mymemory = realloc(lpAddress, dwSize); - if (flAllocationType & MEM_COMMIT) - ZeroMemory(mymemory, dwSize); // original VirtualAlloc does this (if..) - return mymemory; -} - -BOOL VirtualFree(LPVOID lpAddress, size_t dwSize, - DWORD dwFreeType) { - free(lpAddress); - return TRUE; -} diff --git a/source/linux/windows/memory.h b/source/linux/windows/memory.h deleted file mode 100644 index 9f70a180..00000000 --- a/source/linux/windows/memory.h +++ /dev/null @@ -1,6 +0,0 @@ -#pragma once - -#define MoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) -#define FillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) -#define EqualMemory(Destination,Source,Length) (!memcmp((Destination),(Source),(Length))) -#define CopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length))