Introduce a LinuxFrame.

Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
Andrea Odetti 2020-12-27 20:25:42 +00:00
parent c4f3296336
commit 7d6439fefd
23 changed files with 104 additions and 107 deletions

View file

@ -32,9 +32,9 @@ add_library(appleii SHARED
SaveState.cpp
SynchronousEventManager.cpp
Video.cpp
Frame.cpp
Core.cpp
Utilities.cpp
FrameBase.cpp
Configuration/PropertySheetHelper.cpp
@ -60,11 +60,11 @@ add_library(appleii SHARED
linux/registry.cpp
linux/keyboard.cpp
linux/videobuffer.cpp
linux/linuxframe.cpp
linux/duplicates/Debug.cpp
linux/duplicates/WinVideo.cpp
linux/duplicates/Joystick.cpp
linux/duplicates/WinFrame.cpp
linux/duplicates/SerialComms.cpp
linux/duplicates/PropertySheet.cpp
linux/duplicates/Tfe.cpp

View file

@ -8,7 +8,7 @@
// this does not include the main event loop which is left in the arch specific area
// nor the actual rendering of the video buffer to screen
#include "Configuration/PropertySheet.h"
#include "Configuration/IPropertySheet.h"
IPropertySheet& GetPropertySheet();
#include "FrameBase.h"

View file

@ -2,7 +2,7 @@ include(GNUInstallDirs)
add_library(common2 STATIC
resources.cpp
configuration.cpp
fileregistry.cpp
programoptions.cpp
utils.cpp
timer.cpp

View file

@ -17,7 +17,6 @@
#include "Speaker.h"
#include "Log.h"
#include "CPU.h"
#include "Frame.h"
#include "Memory.h"
#include "LanguageCard.h"
#include "MouseInterface.h"
@ -28,6 +27,7 @@
#include "RGBMonitor.h"
#include "Riff.h"
#include "Utilities.h"
#include "Interface.h"
#include <libgen.h>
#include <unistd.h>
@ -75,7 +75,7 @@ void initialiseEmulator()
SetCurrentCLK6502();
CheckCpu();
GetAppleWindowTitle();
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
DSInit();
MB_Initialize();

View file

@ -1,8 +1,6 @@
#include "StdAfx.h"
#include "frontends/libretro/game.h"
#include "Frame.h"
#include "Common.h"
#include "CardManager.h"
#include "Core.h"
@ -251,7 +249,7 @@ void Game::keyboardEmulation()
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
updateWindowTitle();
}
if (checkButtonPressed(RETRO_DEVICE_ID_JOYPAD_L))
@ -263,7 +261,7 @@ void Game::keyboardEmulation()
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
updateWindowTitle();
}
if (checkButtonPressed(RETRO_DEVICE_ID_JOYPAD_START))

View file

@ -8,15 +8,3 @@ int MessageBox(HWND, const char * text, const char * caption, UINT type)
log_cb(RETRO_LOG_INFO, "RA2: %s: %s - %s\n", __FUNCTION__, caption, text);
return IDOK;
}
void FrameDrawDiskLEDS(HDC x)
{
}
void FrameDrawDiskStatus(HDC x)
{
}
void FrameRefreshStatus(int x, bool)
{
}

View file

@ -3,8 +3,8 @@
#include <cstring>
#include "StdAfx.h"
#include "Frame.h"
#include "Common.h"
#include "Video.h"
#include "linux/version.h"
#include "linux/paddle.h"

View file

@ -13,6 +13,7 @@
#include "NTSC.h"
#include "SaveState.h"
#include "Utilities.h"
#include "Interface.h"
#include "linux/benchmark.h"
#include "linux/paddle.h"
@ -90,7 +91,7 @@ namespace
g_dwCyclesThisFrame = g_dwCyclesThisFrame % dwClksPerFrame;
if (!options.headless)
{
VideoRedrawScreen();
NVideoRedrawScreen();
}
}
@ -150,13 +151,11 @@ namespace
NVideoInitialize(options.headless);
applyOptions(options);
CardManager & cardManager = GetCardMgr();
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
if (options.benchmark)
{
VideoBenchmark(&VideoRedrawScreen, &VideoRedrawScreen);
VideoBenchmark(&NVideoRedrawScreen, &NVideoRedrawScreen);
}
else
{

View file

@ -350,11 +350,6 @@ int MessageBox(HWND, const char * text, const char * caption, UINT)
return IDOK;
}
void FrameRefreshStatus(int x, bool)
{
// std::cerr << "Status: " << x << std::endl;
}
void NVideoInitialize(const bool headless)
{
frame.reset(new Frame());
@ -375,7 +370,7 @@ void NVideoInitialize(const bool headless)
}
}
void VideoRedrawScreen()
void NVideoRedrawScreen()
{
VideoUpdateFlash();
FrameRefresh();

View file

@ -3,7 +3,7 @@
int ProcessKeyboard();
void ProcessInput();
void NVideoInitialize(const bool headless);
void VideoRedrawScreen();
void NVideoRedrawScreen();
extern double g_relativeSpeed;

View file

@ -320,7 +320,7 @@ void setAppleWinPreferences(const PreferenceData & currentData, const Preference
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
}
}

View file

@ -10,7 +10,6 @@
#include "Harddisk.h"
#include "Log.h"
#include "CPU.h"
#include "Frame.h"
#include "Memory.h"
#include "LanguageCard.h"
#include "Mockingboard.h"
@ -85,7 +84,7 @@ namespace
GetAppleWindowTitle();
window->setWindowTitle(QString::fromStdString(g_pAppTitle));
FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
GetFrame().FrameRefreshStatus(DRAW_LEDS | DRAW_BUTTON_DRIVES, true);
// ResetDefaultMachineMemTypes();
@ -593,7 +592,7 @@ void QApple::on_actionNext_video_mode_triggered()
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
}
void QApple::loadStateFile(const QString & filename)

View file

@ -10,7 +10,6 @@
#include "CardManager.h"
#include "MouseInterface.h"
#include "Core.h"
#include "Frame.h"
#include "Video.h"
Video::Video(QWidget *parent) : VIDEO_BASECLASS(parent)

View file

@ -15,7 +15,6 @@
#include "Core.h"
#include "Disk.h"
#include "CPU.h"
#include "Frame.h"
#include "Video.h"
#include "Windows/WinVideo.h"
#include "NTSC.h"
@ -44,7 +43,7 @@ namespace
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
updateWindowTitle(win);
}
@ -58,7 +57,7 @@ namespace
Config_Save_Video();
VideoReinitialize();
VideoRedrawScreen();
GetFrame().VideoRedrawScreen();
updateWindowTitle(win);
}

View file

@ -21,7 +21,6 @@
#include "Core.h"
#include "Log.h"
#include "CPU.h"
#include "Frame.h"
#include "NTSC.h"
#include "SaveState.h"

View file

@ -2,15 +2,16 @@
#include "Interface.h"
#include "linux/duplicates/PropertySheet.h"
HINSTANCE g_hInstance = (HINSTANCE)0;
void SetLoadedSaveStateFlag(bool)
{
}
#include "linux/linuxframe.h"
IPropertySheet& GetPropertySheet()
{
static CPropertySheet sg_PropertySheet;
return sg_PropertySheet;
}
FrameBase& GetFrame()
{
static LinuxFrame sg_LinuxFrame;
return sg_LinuxFrame;
}

View file

@ -1,24 +0,0 @@
#include "StdAfx.h"
#include "Windows/WinFrame.h"
HWND g_hFrameWindow = (HWND)0;
BOOL g_bConfirmReboot = 1;
bool g_bFreshReset = false;
void FrameSetCursorPosByMousePos()
{
}
void FrameUpdateApple2Type()
{
}
int SetViewportScale(int nNewScale, bool bForce /*=false*/)
{
return nNewScale;
}
void SetFullScreenShowSubunitStatus(bool bShow)
{
}

View file

@ -2,13 +2,6 @@
#include "Video.h"
#include "NTSC.h"
#include "Windows/WinVideo.h"
void VideoRedrawScreen(void)
{
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
VideoRefreshScreen(g_uVideoMode, true);
}
void VideoRefreshScreen ( uint32_t uRedrawWholeScreenVideoMode /* =0*/, bool bRedrawWholeScreen /* =false*/ )
{

View file

@ -15,16 +15,9 @@ HRSRC FindResource(void *, const char * filename, const char *);
HBITMAP LoadBitmap(HINSTANCE hInstance, const char * filename);
LONG GetBitmapBits(HBITMAP hbit, LONG cb, LPVOID lpvBits);
// Frame
void FrameDrawDiskLEDS(HDC x);
void FrameDrawDiskStatus(HDC x);
void FrameRefreshStatus(int x, bool);
// Keyboard
BYTE KeybGetKeycode ();
BYTE KeybGetKeycode();
BYTE KeybReadData();
BYTE KeybReadFlag();
@ -32,7 +25,6 @@ BYTE KeybReadFlag();
BYTE JoyReadButton(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
BYTE JoyReadPosition(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG uExecutedCycles);
void JoyResetPosition(ULONG uExecutedCycles);
// MessageBox

View file

@ -0,0 +1,54 @@
#include "StdAfx.h"
#include "linux/linuxframe.h"
#include "Video.h"
#include "Windows/WinVideo.h"
#include "NTSC.h"
void LinuxFrame::FrameDrawDiskLEDS(HDC hdc)
{
}
void LinuxFrame::FrameDrawDiskStatus(HDC hdc)
{
}
void LinuxFrame::FrameRefreshStatus(int, bool /* bUpdateDiskStatus */)
{
}
void LinuxFrame::FrameUpdateApple2Type()
{
}
void LinuxFrame::FrameSetCursorPosByMousePos()
{
}
void LinuxFrame::VideoRedrawScreen()
{
// NB. Can't rely on g_uVideoMode being non-zero (ie. so it can double up as a flag) since 'GR,PAGE1,non-mixed' mode == 0x00.
VideoRefreshScreen(g_uVideoMode, true);
}
void LinuxFrame::SetFullScreenShowSubunitStatus(bool /* bShow */)
{
}
bool LinuxFrame::GetBestDisplayResolutionForFullScreen(UINT& /* bestWidth */, UINT& /* bestHeight */ , UINT /* userSpecifiedHeight */)
{
return false;
}
int LinuxFrame::SetViewportScale(int nNewScale, bool /* bForce */)
{
return nNewScale;
}
void LinuxFrame::SetAltEnterToggleFullScreen(bool /* mode */)
{
}
void LinuxFrame::SetLoadedSaveStateFlag(const bool /* bFlag */)
{
}

21
source/linux/linuxframe.h Normal file
View file

@ -0,0 +1,21 @@
#pragma once
#include "FrameBase.h"
class LinuxFrame : public FrameBase
{
public:
virtual void FrameDrawDiskLEDS(HDC hdc);
virtual void FrameDrawDiskStatus(HDC hdc);
virtual void FrameRefreshStatus(int, bool bUpdateDiskStatus = true);
virtual void FrameUpdateApple2Type();
virtual void FrameSetCursorPosByMousePos();
virtual void VideoRedrawScreen();
virtual void SetFullScreenShowSubunitStatus(bool bShow);
virtual bool GetBestDisplayResolutionForFullScreen(UINT& bestWidth, UINT& bestHeight, UINT userSpecifiedHeight = 0);
virtual int SetViewportScale(int nNewScale, bool bForce = false);
virtual void SetAltEnterToggleFullScreen(bool mode);
virtual void SetLoadedSaveStateFlag(const bool bFlag);
};

View file

@ -2,7 +2,6 @@
#include "StdAfx.h"
#include "Video.h"
#include "Frame.h"
#include "NTSC.h"
void VideoBufferInitialize()

View file

@ -15,15 +15,9 @@ HRSRC FindResource(void *, const char * filename, const char *)
return HRSRC();
}
// Frame
void FrameDrawDiskLEDS(HDC x) { }
void FrameDrawDiskStatus(HDC x) { }
void FrameRefreshStatus(int x, bool) { }
// Keyboard
BYTE KeybGetKeycode () { return 0; }
BYTE KeybGetKeycode() { return 0; }
BYTE KeybReadData() { return 0; }
BYTE KeybReadFlag() { return 0; }
@ -31,15 +25,6 @@ BYTE KeybReadFlag() { return 0; }
BYTE JoyReadButton(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft) { return 0; }
BYTE JoyReadPosition(WORD pc, WORD addr, BYTE bWrite, BYTE d, ULONG nCyclesLeft) { return 0; }
void JoyResetPosition(ULONG nCyclesLeft) { }
// Registry
BOOL RegLoadString (LPCTSTR section, LPCTSTR key, BOOL peruser, LPTSTR buffer, DWORD chars) { return FALSE; }
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD *value) { return FALSE; }
BOOL RegLoadValue (LPCTSTR section, LPCTSTR key, BOOL peruser, BOOL *value) { return FALSE; }
void RegSaveString (LPCTSTR section, LPCTSTR key, BOOL peruser, const std::string & buffer) { }
void RegSaveValue (LPCTSTR section, LPCTSTR key, BOOL peruser, DWORD value) { }
// MessageBox