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
sh95014 committed Dec 8, 2023
2 parents 7a32b7c + c4ff239 commit 18636ac
Show file tree
Hide file tree
Showing 16 changed files with 149 additions and 42 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: build

on:
push:
pull_request:
workflow_run:
# Use a workflow as a trigger of scheduled builds. Forked repositories can disable scheduled builds by disabling
# "scheduled" workflow, while maintaining ability to perform local CI builds.
workflows:
- scheduled
branches:
- master
- docking
types:
- requested

jobs:
Linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get -y install $(cat source/linux/raspbian.list.txt)
- name: Build
run: |
cmake -S . -B build
cmake --build build
7 changes: 7 additions & 0 deletions bin/History.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ https://github.com/AppleWin/AppleWin/issues/new
Tom Charlesworth


1.30.16.0 - 26 Nov 2023
-----------------------
- [Change #1258] New command line: -mac-lc-card-dlgr to support the DLGR display bug in the 'Apple IIe card for Mac LC'.
- NB. This switch only has an effect when in either "Color (Composite Idealized)" or "RGB Card/Monitor" video modes.
- [Bug #1197] Phasor: 6522's AY RESET always resets both attached AYs, regardless of Phasor mode or chip-select bits.


1.30.15.0 - 29 Jul 2023
-----------------------
- [Change #1162] Fix joysticks not detected: first & second devices are not always at index 0 & 1. [@fabricecaruso]
Expand Down
3 changes: 3 additions & 0 deletions help/CommandLine.html
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,9 @@ <h2 style="COLOR: rgb(0,128,0)">Command line</h2>
-rgb-card-invert-bit7<br>
Force the RGB card to invert bit7 in MIX mode. Enables the correct rendering for Dragon Wars.<br>
Use in conjunction with the 'Color (RGB Card/Monitor)' video mode.<br><br>
-mac-lc-card-dlgr<br>
Support the DLGR display bug in the 'Apple IIe card for Mac LC'.<br>
NB. This switch only has an effect when in either "Color (Composite Idealized)" or "RGB Card/Monitor" video modes.<br><br>
-50hz<br>
Support 50Hz(PAL) video refresh rate and PAL 1.016MHz base CPU clock.<br><br>
-60hz<br>
Expand Down
Binary file added resource/debug6502.ttf
Binary file not shown.
2 changes: 1 addition & 1 deletion resource/version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define APPLEWIN_VERSION 1,30,15,0
#define APPLEWIN_VERSION 1,30,16,0

#define xstr(a) str(a)
#define str(a) #a
Expand Down
4 changes: 4 additions & 0 deletions source/CmdLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,10 @@ bool ProcessCmdLine(LPSTR lpCmdLine)
{
RGB_SetInvertBit7(true);
}
else if (strcmp(lpCmdLine, "-mac-lc-card-dlgr") == 0) // GH#1258
{
RGB_SetMacLCCardDLGR(true);
}
else if (strcmp(lpCmdLine, "-screenshot-and-exit") == 0) // GH#616: For testing - Use in combination with -load-state
{
g_cmdLine.szScreenshotFilename = GetCurrArg(lpNextArg);
Expand Down
14 changes: 13 additions & 1 deletion source/RGBMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1049,7 +1049,8 @@ void UpdateDLoResCell (int x, int y, uint16_t addr, bgra_t *pVideoAddress)

const BYTE auxval_h = auxval >> 4;
const BYTE auxval_l = auxval & 0xF;
auxval = (ROL_NIB(auxval_h)<<4) | ROL_NIB(auxval_l);
if (!RGB_IsMacLCCardDLGR()) // "Apple IIe Card for Macintosh LC" has a bug in its DLGR implementation (GH#1258)
auxval = (ROL_NIB(auxval_h)<<4) | ROL_NIB(auxval_l);

if ((y & 4) == 0)
{
Expand Down Expand Up @@ -1213,6 +1214,7 @@ static UINT g_rgbFlags = 0;
static UINT g_rgbMode = 0;
static WORD g_rgbPrevAN3Addr = 0;
static bool g_rgbInvertBit7 = false;
static bool g_rgbMacLCCardDLGR = false; // TODO: Persist to save-state

// Video7 RGB card:
// . Clock in the !80COL state to define the 2 flags: F2, F1
Expand Down Expand Up @@ -1273,6 +1275,11 @@ bool RGB_IsMixModeInvertBit7(void)
return RGB_IsMixMode() && g_rgbInvertBit7;
}

bool RGB_IsMacLCCardDLGR(void)
{
return g_rgbMacLCCardDLGR;
}

void RGB_ResetState(void)
{
g_rgbFlags = 0;
Expand All @@ -1285,6 +1292,11 @@ void RGB_SetInvertBit7(bool state)
g_rgbInvertBit7 = state;
}

void RGB_SetMacLCCardDLGR(bool state)
{
g_rgbMacLCCardDLGR = state;
}

//===========================================================================

#define SS_YAML_KEY_RGB_CARD "AppleColor RGB Adaptor"
Expand Down
2 changes: 2 additions & 0 deletions source/RGBMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ bool RGB_Is160Mode(void);
bool RGB_IsMixMode(void);
bool RGB_Is560Mode(void);
bool RGB_IsMixModeInvertBit7(void);
bool RGB_IsMacLCCardDLGR(void);
void RGB_ResetState(void);
void RGB_SetInvertBit7(bool state);
void RGB_SetMacLCCardDLGR(bool state);

void RGB_SaveSnapshot(class YamlSaveHelper& yamlSaveHelper);
void RGB_LoadSnapshot(class YamlLoadHelper& yamlLoadHelper, UINT cardVersion);
Expand Down
12 changes: 11 additions & 1 deletion source/frontends/qt/qapple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ namespace
return timeInMS;
}

bool isWayland()
{
return QApplication::platformName() == "wayland";
}
}


Expand Down Expand Up @@ -155,7 +159,13 @@ void QApple::readSettings()

restoreGeometry(windowGeometry);
restoreState(windowState);
myEmulatorWindow->restoreGeometry(emulatorGeometry);

if (!isWayland())
{
// this works very badly in wayland
// see https://bugreports.qt.io/browse/QTBUG-80612
myEmulatorWindow->restoreGeometry(emulatorGeometry);
}
}

void QApple::startEmulator()
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/imgui/imgui
97 changes: 62 additions & 35 deletions source/frontends/sdl/imgui/sdldebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ namespace
printBoolean(label, value, "OFF", "ON");
}

char getPrintableChar(const uint8_t x)
char getPrintableChar(const uint8_t x) // copied from FormatCharTxtCtrl
{
if (x >= 0x20 && x <= 0x7e)
char c = x & 0x7F; // .32 Changed: Lo now maps High Ascii to printable chars. i.e. ML1 D0D0
if (c < 0x20) // SPACE
{
return x;
}
else
{
return '.';
c += '@'; // map ctrl chars to visible
}
return c;
}

void printReg(const char label, const BYTE value)
Expand All @@ -52,6 +50,48 @@ namespace
ImGui::TextColored(color, "%s", text);
}

void adjustMouseText(const char* text, size_t length, char* out)
{
for (size_t i = 0; i < length; ++i)
{
const auto ch = *(text + i) & 0x7F; // same as DebuggerPrint()
// to understand the conversion, look at
// resource/Debug_Font.bmp vs resource/debug6502.ttf
// the latter comes from https://fontstruct.com/fontstructions/show/1912741/debug6502
switch (ch)
{
case 0x00 ... 0x1F: // mouse text -> U+00C0
*out = 0xC3;
++out;
*out = 0x80 + (ch - 0x00);
break;
case 0x7F: // -> U+00BF
*out = 0xC2;
++out;
*out = 0xBF;
break;
case 0x80 ... 0x8F: // bookmarks, not currently used -> U+00F0
*out = 0xC3;
++out;
*out = 0xB0 + (ch - 0x80);
break;
default:
*out = ch;
}
++out;
}
*out = 0x00;
}

// use this if "text" may contain mouse text
void safeDebuggerTextColored(int iColor, const char* text)
{
const size_t length = strlen(text);
char utf8[2 * length + 1]; // worst case is 2-bytes utf8 encoding
adjustMouseText(text, length, utf8);
debuggerTextColored(iColor, utf8);
}

void displayDisassemblyLine(const DisasmLine_t& line, const int bDisasmFormatFlags)
{
const char* pMnemonic = g_aOpcodes[line.iOpcode].sMnemonic;
Expand Down Expand Up @@ -272,9 +312,9 @@ namespace sa2
ImGui::TableSetupScrollFreeze(0, 1); // Make top row always visible
ImGui::TableSetupColumn("", 0, 1);
ImGui::TableSetupColumn("Address", 0, 5);
ImGui::TableSetupColumn("Opcode", 0, 8);
ImGui::TableSetupColumn("Opcode", 0, 6);
ImGui::TableSetupColumn("Symbol", 0, 10);
ImGui::TableSetupColumn("Disassembly", 0, 20);
ImGui::TableSetupColumn("Disassembly", 0, 15);
ImGui::TableSetupColumn("Target", 0, 4);
ImGui::TableSetupColumn("Branch", 0, 3);
ImGui::TableSetupColumn("Immediate", 0, 4);
Expand Down Expand Up @@ -391,18 +431,7 @@ namespace sa2
ImGui::TableNextColumn();
if (bDisasmFormatFlags & DISASM_FORMAT_BRANCH)
{
if ((unsigned char)*line.sBranch == 0x8A)
{
debuggerTextColored(FG_DISASM_BRANCH, "v");
}
else if ((unsigned char)*line.sBranch == 0x8B)
{
debuggerTextColored(FG_DISASM_BRANCH, "^");
}
else
{
ImGui::TextUnformatted(line.sBranch);
}
safeDebuggerTextColored(FG_DISASM_BRANCH, line.sBranch);
}

ImGui::TableNextColumn();
Expand All @@ -428,9 +457,7 @@ namespace sa2
{
color = FG_DISASM_CHAR;
}
// FIXME: handle 0xFF, which displays as a gray block on AppleWin
// but ImGui doesn't seem to have an appropriate character to map to.
debuggerTextColored(color, line.sImmediate);
safeDebuggerTextColored(color, line.sImmediate);
}

ImGui::TableNextColumn();
Expand Down Expand Up @@ -563,23 +590,30 @@ namespace sa2
for (int i = g_nConsoleDisplayTotal; i >= CONSOLE_FIRST_LINE; --i)
{
const conchar_t * src = g_aConsoleDisplay[i];

char line[CONSOLE_WIDTH + 1];
char lineMouseText[2 * CONSOLE_WIDTH + 1];
size_t length = 0;

ImGui::TableNextRow();
ImGui::TableNextColumn();
COLORREF currentColor = DebuggerGetColor( FG_CONSOLE_OUTPUT );

const auto textAndReset = [&line, &length, & currentColor] () {
const auto textAndReset = [&line, &lineMouseText, &length, &currentColor] () {
line[length] = 0;
length = 0;
const ImVec4 color = colorrefToImVec4(currentColor);
ImGui::TextColored(color, "%s", line);
adjustMouseText(line, length, lineMouseText);
ImGui::TextColored(color, "%s", lineMouseText);
length = 0;
};

for (size_t j = 0; j < CONSOLE_WIDTH; ++j)
{
const conchar_t g = src[j];
if (!g)
{
break;
}
if (ConsoleColor_IsColorOrMouse(g))
{
// colors propagate till next color information
Expand All @@ -589,14 +623,7 @@ namespace sa2
currentColor = ConsoleColor_GetColor(g);
}
line[length] = ConsoleChar_GetChar(g);
if (line[length])
{
++length;
}
else
{
break;
}
++length;
}
textAndReset();
}
Expand Down
6 changes: 5 additions & 1 deletion source/frontends/sdl/imgui/sdlimguiframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,10 @@ namespace sa2
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO();

io.Fonts->AddFontDefault();
const std::string debugFontFilename = getResourcePath("debug6502.ttf");
myDebuggerFont = io.Fonts->AddFontFromFileTTF(debugFontFilename.c_str(), 13);

myIniFileLocation = common2::GetConfigFile("imgui.ini");
if (myIniFileLocation.empty())
{
Expand Down Expand Up @@ -228,7 +232,7 @@ namespace sa2
ImGui::NewFrame();

// "this" is a bit circular
mySettings.show(this);
mySettings.show(this, myDebuggerFont);
DrawAppleVideo();

ImGui::Render();
Expand Down
1 change: 1 addition & 0 deletions source/frontends/sdl/imgui/sdlimguiframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace sa2
ImTextureID myTexture;

std::string myIniFileLocation;
ImFont* myDebuggerFont;
ImGuiSettings mySettings;
};

Expand Down
4 changes: 3 additions & 1 deletion source/frontends/sdl/imgui/sdlsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ namespace sa2
ImGui::End();
}

void ImGuiSettings::show(SDLFrame * frame)
void ImGuiSettings::show(SDLFrame * frame, ImFont * debuggerFont)
{
if (myShowSettings)
{
Expand All @@ -669,7 +669,9 @@ namespace sa2

if (myDebugger.showDebugger)
{
ImGui::PushFont(debuggerFont);
myDebugger.drawDebugger(frame);
ImGui::PopFont();
}

if (myShowAbout)
Expand Down
2 changes: 1 addition & 1 deletion source/frontends/sdl/imgui/sdlsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace sa2
class ImGuiSettings
{
public:
void show(SDLFrame* frame);
void show(SDLFrame* frame, ImFont * debuggerFont);
float drawMenuBar(SDLFrame* frame);
void resetDebuggerCycles();

Expand Down
2 changes: 2 additions & 0 deletions source/linux/raspbian.list.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake
g++
ninja-build
pkg-config
libyaml-dev
libminizip-dev
Expand Down

0 comments on commit 18636ac

Please sign in to comment.