Skip to content

Commit

Permalink
Incorporate VidHD fro AW.
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
  • Loading branch information
audetto committed Dec 3, 2021
1 parent 79668e4 commit 9439b1b
Show file tree
Hide file tree
Showing 23 changed files with 108 additions and 84 deletions.
2 changes: 2 additions & 0 deletions source/CMakeLists.txt
Expand Up @@ -47,6 +47,7 @@ set(SOURCE_FILES
Debugger/Debugger_Commands.cpp
Debugger/Util_MemoryTextFile.cpp

VidHD.cpp
SSI263.cpp
Speaker.cpp
SoundCore.cpp
Expand Down Expand Up @@ -115,6 +116,7 @@ set(SOURCE_FILES
)

set(HEADER_FILES
VidHD.cpp
SSI263.h
SSI263Phonemes.h
Speaker.h
Expand Down
6 changes: 3 additions & 3 deletions source/frontends/common2/commonframe.cpp
Expand Up @@ -77,10 +77,10 @@ namespace common2
g_sProgramDir = getResourcePath("/bin/");
}

void CommonFrame::Initialize()
void CommonFrame::Initialize(bool resetVideoState)
{
InitialiseEmulator();
LinuxFrame::Initialize();
LinuxFrame::Initialize(resetVideoState);
}

void CommonFrame::Destroy()
Expand All @@ -93,7 +93,7 @@ namespace common2
void CommonFrame::Restart()
{
Destroy();
Initialize();
Initialize(false);
}

BYTE* CommonFrame::GetResource(WORD id, LPCSTR lpType, DWORD expectedSize)
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/common2/commonframe.h
Expand Up @@ -12,7 +12,7 @@ namespace common2
public:
CommonFrame();

void Initialize() override;
void Initialize(bool resetVideoState) override;
void Destroy() override;
void Restart() override;

Expand Down
1 change: 1 addition & 0 deletions source/frontends/common2/utils.cpp
Expand Up @@ -90,6 +90,7 @@ namespace common2

g_bFullSpeed = false;

GetVideo().SetVidHD(false);
LoadConfiguration();
LoadUthernet2();
SetCurrentCLK6502();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/libretro/game.cpp
Expand Up @@ -36,7 +36,7 @@ namespace ra2
myFrame.reset(new ra2::RetroFrame());

SetFrame(myFrame);
myFrame->Initialize();
myFrame->Initialize(true);

Video & video = GetVideo();
// should the user be allowed to tweak 0.75
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/libretro/retroframe.cpp
Expand Up @@ -106,9 +106,9 @@ namespace ra2
video_cb(myVideoBuffer.data() + myOffset, myBorderlessWidth, myBorderlessHeight, myPitch);
}

void RetroFrame::Initialize()
void RetroFrame::Initialize(bool resetVideoState)
{
CommonFrame::Initialize();
CommonFrame::Initialize(resetVideoState);
FrameRefreshStatus(DRAW_TITLE);

Video & video = GetVideo();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/libretro/retroframe.h
Expand Up @@ -15,7 +15,7 @@ namespace ra2

void VideoPresentScreen() override;
void FrameRefreshStatus(int drawflags) override;
void Initialize() override;
void Initialize(bool resetVideoState) override;
void Destroy() override;
int FrameMessageBox(LPCSTR lpText, LPCSTR lpCaption, UINT uType) override;
void GetBitmap(LPCSTR lpBitmapName, LONG cb, LPVOID lpvBits) override;
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/ncurses/main.cpp
Expand Up @@ -152,7 +152,7 @@ namespace

const Initialisation init(frame, paddle);
applyOptions(options);
frame->Initialize();
frame->Initialize(true);

na2::SetCtrlCHandler(options.headless);

Expand Down
4 changes: 2 additions & 2 deletions source/frontends/ncurses/nframe.cpp
Expand Up @@ -47,9 +47,9 @@ namespace na2
// so we can run headless
}

void NFrame::Initialize()
void NFrame::Initialize(bool resetVideoState)
{
CommonFrame::Initialize();
CommonFrame::Initialize(resetVideoState);
myTextFlashCounter = 0;
myTextFlashState = 0;
myAsciiArt.reset(new ASCIIArt());
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/ncurses/nframe.h
Expand Up @@ -21,7 +21,7 @@ namespace na2
WINDOW * GetWindow();
WINDOW * GetStatus();

void Initialize() override;
void Initialize(bool resetVideoState) override;
void Destroy() override;
void VideoPresentScreen() override;
int FrameMessageBox(LPCSTR lpText, LPCSTR lpCaption, UINT uType) override;
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/qt/qapple.cpp
Expand Up @@ -104,7 +104,7 @@ namespace
MB_Initialize();
SpkrInitialize();
MemInitialize();
frame->Initialize();
frame->Initialize(true);

CardManager & cardManager = GetCardMgr();
cardManager.GetDisk2CardMgr().Reset();
Expand Down
4 changes: 2 additions & 2 deletions source/frontends/qt/qtframe.cpp
Expand Up @@ -36,9 +36,9 @@ void QtFrame::FrameRefreshStatus(int drawflags)
}
}

void QtFrame::Initialize()
void QtFrame::Initialize(bool resetVideoState)
{
LinuxFrame::Initialize();
LinuxFrame::Initialize(resetVideoState);
FrameRefreshStatus(DRAW_TITLE);
myEmulator->loadVideoSettings();
myEmulator->displayLogo();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/qt/qtframe.h
Expand Up @@ -16,7 +16,7 @@ class QtFrame : public LinuxFrame

void VideoPresentScreen() override;
void FrameRefreshStatus(int drawflags) override;
void Initialize() override;
void Initialize(bool resetVideoState) override;
void Destroy() override;

int FrameMessageBox(LPCSTR lpText, LPCSTR lpCaption, UINT uType) override;
Expand Down
29 changes: 17 additions & 12 deletions source/frontends/sdl/imgui/sdlimguiframe.cpp
Expand Up @@ -96,9 +96,25 @@ namespace sa2
ImGui::StyleColorsDark();

ImGui_ImplSDL2_InitForOpenGL(myWindow.get(), myGLContext);

ImGui_ImplOpenGL3_Init();

myDeadTopZone = 0;
myTexture = 0;
}

SDLImGuiFrame::~SDLImGuiFrame()
{
glDeleteTextures(1, &myTexture);
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
SDL_GL_DeleteContext(myGLContext);
}

void SDLImGuiFrame::Initialize(bool resetVideoState)
{
SDLFrame::Initialize(resetVideoState);
glDeleteTextures(1, &myTexture);
glGenTextures(1, &myTexture);

Video & video = GetVideo();
Expand All @@ -114,17 +130,6 @@ namespace sa2
myOffset = (width * borderHeight + borderWidth) * sizeof(bgra_t);

allocateTexture(myTexture, myBorderlessWidth, myBorderlessHeight);

myDeadTopZone = 0;
}

SDLImGuiFrame::~SDLImGuiFrame()
{
glDeleteTextures(1, &myTexture);
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplSDL2_Shutdown();
ImGui::DestroyContext();
SDL_GL_DeleteContext(myGLContext);
}

void SDLImGuiFrame::UpdateTexture()
Expand Down
1 change: 1 addition & 0 deletions source/frontends/sdl/imgui/sdlimguiframe.h
Expand Up @@ -21,6 +21,7 @@ namespace sa2

void VideoPresentScreen() override;
void ResetSpeed() override;
void Initialize(bool resetVideoState) override;

protected:

Expand Down
87 changes: 44 additions & 43 deletions source/frontends/sdl/imgui/settingshelper.cpp
Expand Up @@ -16,60 +16,61 @@ namespace
{
const std::map<SS_CARDTYPE, std::string> cards =
{
{CT_Empty, "CT_Empty"},
{CT_Disk2, "CT_Disk2"},
{CT_SSC, "CT_SSC"},
{CT_MockingboardC, "CT_MockingboardC"},
{CT_GenericPrinter, "CT_GenericPrinter"},
{CT_GenericHDD, "CT_GenericHDD"},
{CT_GenericClock, "CT_GenericClock"},
{CT_MouseInterface, "CT_MouseInterface"},
{CT_Z80, "CT_Z80"},
{CT_Phasor, "CT_Phasor"},
{CT_Echo, "CT_Echo"},
{CT_SAM, "CT_SAM"},
{CT_80Col, "CT_80Col"},
{CT_Extended80Col, "CT_Extended80Col"},
{CT_RamWorksIII, "CT_RamWorksIII"},
{CT_Uthernet, "CT_Uthernet"},
{CT_LanguageCard, "CT_LanguageCard"},
{CT_LanguageCardIIe, "CT_LanguageCardIIe"},
{CT_Saturn128K, "CT_Saturn128K"},
{CT_FourPlay, "CT_FourPlay"},
{CT_SNESMAX, "CT_SNESMAX"},
{CT_Uthernet2, "CT_Uthernet2"},
{CT_Empty, "Empty"},
{CT_Disk2, "Disk2"},
{CT_SSC, "SSC"},
{CT_MockingboardC, "MockingboardC"},
{CT_GenericPrinter, "GenericPrinter"},
{CT_GenericHDD, "GenericHDD"},
{CT_GenericClock, "GenericClock"},
{CT_MouseInterface, "MouseInterface"},
{CT_Z80, "Z80"},
{CT_Phasor, "Phasor"},
{CT_Echo, "Echo"},
{CT_SAM, "SAM"},
{CT_80Col, "80Col"},
{CT_Extended80Col, "Extended80Col"},
{CT_RamWorksIII, "RamWorksIII"},
{CT_Uthernet, "Uthernet"},
{CT_LanguageCard, "LanguageCard"},
{CT_LanguageCardIIe, "LanguageCardIIe"},
{CT_Saturn128K, "Saturn128K"},
{CT_FourPlay, "FourPlay"},
{CT_SNESMAX, "SNESMAX"},
{CT_VidHD, "VidHD"},
{CT_Uthernet2, "Uthernet2"},
};

const std::map<eApple2Type, std::string> apple2Types =
{
{A2TYPE_APPLE2, "A2TYPE_APPLE2"},
{A2TYPE_APPLE2PLUS, "A2TYPE_APPLE2PLUS"},
{A2TYPE_APPLE2JPLUS, "A2TYPE_APPLE2JPLUS"},
{A2TYPE_APPLE2E, "A2TYPE_APPLE2E"},
{A2TYPE_APPLE2EENHANCED, "A2TYPE_APPLE2EENHANCED"},
{A2TYPE_APPLE2C, "A2TYPE_APPLE2C"},
{A2TYPE_PRAVETS8M, "A2TYPE_PRAVETS8M"},
{A2TYPE_PRAVETS82, "A2TYPE_PRAVETS82"},
{A2TYPE_BASE64A, "A2TYPE_BASE64A"},
{A2TYPE_PRAVETS8A, "A2TYPE_PRAVETS8A"},
{A2TYPE_TK30002E, "A2TYPE_TK30002E"},
{A2TYPE_APPLE2, "APPLE2"},
{A2TYPE_APPLE2PLUS, "APPLE2PLUS"},
{A2TYPE_APPLE2JPLUS, "APPLE2JPLUS"},
{A2TYPE_APPLE2E, "APPLE2E"},
{A2TYPE_APPLE2EENHANCED, "APPLE2EENHANCED"},
{A2TYPE_APPLE2C, "APPLE2C"},
{A2TYPE_PRAVETS8M, "PRAVETS8M"},
{A2TYPE_PRAVETS82, "PRAVETS82"},
{A2TYPE_BASE64A, "BASE64A"},
{A2TYPE_PRAVETS8A, "PRAVETS8A"},
{A2TYPE_TK30002E, "TK30002E"},
};

const std::map<eCpuType, std::string> cpuTypes =
{
{CPU_6502, "CPU_6502"},
{CPU_65C02, "CPU_65C02"},
{CPU_Z80, "CPU_Z80"},
{CPU_6502, "6502"},
{CPU_65C02, "65C02"},
{CPU_Z80, "Z80"},
};

const std::map<AppMode_e, std::string> appModes =
{
{MODE_LOGO, "MODE_LOGO"},
{MODE_PAUSED, "MODE_PAUSED"},
{MODE_RUNNING, "MODE_RUNNING"},
{MODE_DEBUG, "MODE_DEBUG"},
{MODE_STEPPING, "MODE_STEPPING"},
{MODE_BENCHMARK, "MODE_BENCHMARCK"},
{MODE_LOGO, "LOGO"},
{MODE_PAUSED, "PAUSED"},
{MODE_RUNNING, "RUNNING"},
{MODE_DEBUG, "DEBUG"},
{MODE_STEPPING, "STEPPING"},
{MODE_BENCHMARK, "BENCHMARCK"},
};

const std::map<Disk_Status_e, std::string> statuses =
Expand Down Expand Up @@ -98,7 +99,7 @@ namespace
{0, {CT_Empty, CT_LanguageCard, CT_Saturn128K}},
{1, {CT_Empty, CT_GenericPrinter, CT_Uthernet2}},
{2, {CT_Empty, CT_SSC, CT_Uthernet2}},
{3, {CT_Empty, CT_Uthernet, CT_Uthernet2}},
{3, {CT_Empty, CT_Uthernet, CT_Uthernet2, CT_VidHD}},
{4, {CT_Empty, CT_MockingboardC, CT_MouseInterface, CT_Phasor, CT_Uthernet2}},
{5, {CT_Empty, CT_MockingboardC, CT_Z80, CT_SAM, CT_Disk2, CT_FourPlay, CT_SNESMAX, CT_Uthernet2}},
{6, {CT_Empty, CT_Disk2}},
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/main.cpp
Expand Up @@ -95,7 +95,7 @@ void run_sdl(int argc, const char * argv [])
std::shared_ptr<Paddle> paddle(new sa2::Gamepad(0));
const Initialisation init(frame, paddle);
applyOptions(options);
frame->Initialize();
frame->Initialize(true);

std::cerr << "Default GL swap interval: " << SDL_GL_GetSwapInterval() << std::endl;

Expand Down
9 changes: 6 additions & 3 deletions source/frontends/sdl/renderer/sdlrendererframe.cpp
Expand Up @@ -30,17 +30,20 @@ namespace sa2
throw std::runtime_error(SDL_GetError());
}

const Uint32 format = SDL_PIXELFORMAT_ARGB8888;
printRendererInfo(std::cerr, myRenderer, format, options.sdlDriver);
printRendererInfo(std::cerr, myRenderer, ourFormat, options.sdlDriver);
}

void SDLRendererFrame::Initialize(bool resetVideoState)
{
SDLFrame::Initialize(resetVideoState);
Video & video = GetVideo();

const int width = video.GetFrameBufferWidth();
const int height = video.GetFrameBufferHeight();
const int sw = video.GetFrameBufferBorderlessWidth();
const int sh = video.GetFrameBufferBorderlessHeight();

myTexture.reset(SDL_CreateTexture(myRenderer.get(), format, SDL_TEXTUREACCESS_STATIC, width, height), SDL_DestroyTexture);
myTexture.reset(SDL_CreateTexture(myRenderer.get(), ourFormat, SDL_TEXTUREACCESS_STATIC, width, height), SDL_DestroyTexture);

myRect.x = video.GetFrameBufferBorderWidth();
myRect.y = video.GetFrameBufferBorderHeight();
Expand Down
4 changes: 4 additions & 0 deletions source/frontends/sdl/renderer/sdlrendererframe.h
Expand Up @@ -16,11 +16,15 @@ namespace sa2
SDLRendererFrame(const common2::EmulatorOptions & options);

void VideoPresentScreen() override;
void Initialize(bool resetVideoState) override;

protected:
void GetRelativeMousePosition(const SDL_MouseMotionEvent & motion, double & x, double & y) const override;

private:

static constexpr Uint32 ourFormat = SDL_PIXELFORMAT_ARGB8888;

SDL_Rect myRect;
int myPitch;

Expand Down
4 changes: 2 additions & 2 deletions source/frontends/sdl/sdlframe.cpp
Expand Up @@ -159,9 +159,9 @@ namespace sa2
}
}

void SDLFrame::Initialize()
void SDLFrame::Initialize(bool resetVideoState)
{
CommonFrame::Initialize();
CommonFrame::Initialize(resetVideoState);
mySpeed.reset();
setGLSwapInterval(myTargetGLSwap);
ResetHardware();
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/sdlframe.h
Expand Up @@ -19,7 +19,7 @@ namespace sa2
public:
SDLFrame(const common2::EmulatorOptions & options);

void Initialize() override;
void Initialize(bool resetVideoState) override;
void Destroy() override;

void FrameRefreshStatus(int drawflags) override;
Expand Down

0 comments on commit 9439b1b

Please sign in to comment.