Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix rpi problem dispmanx #195

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ Using LinApple
Clicking in the LinApple window will capture the mouse. It may be
released by pressing any function key.

~~~text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here to remove the table?

| ----------------------------------------------------------------------------------|
| Key | Function |
| -------------- | -----------------------------------------------------------------|
| F1 | Show help screen. |
Expand Down Expand Up @@ -94,7 +96,8 @@ released by pressing any function key.
| Numpad - | Decrease emulation speed. |
| Numpad * | Reset emulation speed. |
| RtCtrl+Numpad | Adjust pdl TrimX (4, 6) or TrimY (2, 8) |
| -------------- | -----------------------------------------------------------------|
| ----------------------------------------------------------------------------------|
~~~

**Warning**: Fullscreen mode does not properly exit in multi-monitor
setups. (This is a bug in SDL 1.2.)
Expand All @@ -108,6 +111,27 @@ images only have files and you must find the correct application to
run. In this case you will need to execute BASIC commands to list the
files on the disk and run programs.

### LinApple Driver Video

~~~text
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be removed so that the below will format as a table.

| --------------------------------------------------------------------------------------|
| driver name | supported resolutions | debugger panel (experimental) | keyboard |
| -------------- | ---------------------- | ----------------------------- | ----------- |
| x11 | all | glitch graph or core dumped | OK |
| -------------- | ---------------------- | ----------------------------- | ----------- |
| fbcon | max 1280x720 in rpi | OK | OK |
| -------------- | ---------------------- | ----------------------------- | ----------- |
| dispmanx | 1920x1080 16:9 | OK | OK |
| | 1280x 720 16:9 | OK | OK |
| | 800x 600 4:3 | OK | OK |
| | 640x 480 4:3 | OK | OK |
| -------------- | ---------------------- | ----------------------------- | ----------- |
| kmsdrm | all | NONE | NONE |
| --------------------------------------------------------------------------------------|
~~~

**Warning**: debugger panel only works in full screen.

### Apple II Commands

This is a brief guide to get you started. For more information see
Expand Down
32 changes: 30 additions & 2 deletions src/Applewin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ static char TITLE_APPLE_2E_ENHANCED_[] = TITLE_APPLE_2E_ENHANCED;

char *g_pAppTitle = TITLE_APPLE_2E_ENHANCED_;

// backend video x11, fbcon, dispmanx, kmsdrm, etc.
char videoDriverName[100];

eApple2Type g_Apple2Type = A2TYPE_APPLE2EEHANCED;

bool behind = 0;
Expand Down Expand Up @@ -408,7 +411,7 @@ bool ValidateDirectory(char *dir)
}
}
}
printf(" ---> %s is dir? %d\n", dir, ret);
printf("%s is dir? %d\n", dir ? dir : "undefined", ret);
return ret;
}

Expand Down Expand Up @@ -711,7 +714,10 @@ void LoadConfiguration()
// Define screen sizes
if (registry) {
if (RegLoadString(TEXT("Configuration"), TEXT("Screen factor"), 1, &szFilename, 16)) {
scrFactor = atof(szFilename);
// fix: prevent resolution change, it usually gives graphic problems with the dispmanx driver
if (strncmp(videoDriverName, "dispmanx", 8) != 0) {
scrFactor = atof(szFilename);
}
if (scrFactor > 0.1) {
g_ScreenWidth = (unsigned int)(g_ScreenWidth * scrFactor);
g_ScreenHeight = (unsigned int)(g_ScreenHeight * scrFactor);
Expand All @@ -734,6 +740,19 @@ void LoadConfiguration()
if (dwTmp > 0) {
g_ScreenHeight = dwTmp;
}

// validate resolutions validate for the dispmanx driver.
if (strncmp(videoDriverName, "dispmanx", 8) == 0) {
if (!((g_ScreenWidth == 1920 && g_ScreenHeight == 1080) ||
(g_ScreenWidth == 1280 && g_ScreenHeight == 720) ||
(g_ScreenWidth == 800 && g_ScreenHeight == 600))) {

// default
g_ScreenWidth = 640;
g_ScreenHeight = 480;
}
}

}
}

Expand Down Expand Up @@ -1130,6 +1149,15 @@ int main(int argc, char *argv[])
DiskInitialize();
CreateColorMixMap(); // For tv emulation g_nAppMode

#ifdef VERSIONSTRING
printf("LinApple %s\n", VERSIONSTRING);
#else
printf("LinApple\n");
#endif

SDL_VideoDriverName(&videoDriverName[0], 100);
printf("Video driver = %s\n", videoDriverName);

do {
// Do initialization that must be repeated for a restart
restart = 0;
Expand Down
5 changes: 4 additions & 1 deletion src/Debugger/Debugger_Help.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ int StringCat ( char * pDst, LPCSTR pSrc, const int nDstSize )

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstringop-truncation"
_tcsncat( pDst, pSrc, nChars );
// secure the character \0
// fix warning: specified bound 2 equals source length.
_tcsncat( pDst, pSrc, nChars - 1);
pDst[nChars - 1] = '\0';
#pragma GCC diagnostic pop

bool bOverflow = (nSpcDst < nLenSrc);
Expand Down
10 changes: 9 additions & 1 deletion src/DiskFTP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,15 @@ struct FTP_file_list_generator_t : public file_list_generator_t {
const std::vector<file_entry_t> FTP_file_list_generator_t::generate_file_list()
{
char ftpdirpath[MAX_PATH];
snprintf(ftpdirpath, MAX_PATH, "%s/%s%s", g_sFTPLocalDir, g_sFTPDirListing, md5str(directory.c_str())); // get path for FTP dir listing
int l;
l = snprintf(ftpdirpath, MAX_PATH,
"%s/%s%s", g_sFTPLocalDir, g_sFTPDirListing, md5str(directory.c_str())); // get path for FTP dir listing

if (!(l>=0 && l<MAX_PATH)) { // check returned value
failure_message = "Failed get path for FTP dir listing";
return {};
}


bool OKI;
#ifndef _WIN32
Expand Down
3 changes: 2 additions & 1 deletion src/Registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ char *php_trim(char *c, int len) {
}

void RegConfPath(const char * filename) {
strncpy(confPath, filename, MAX_PATH);
strncpy(confPath, filename, MAX_PATH-1);
confPath[MAX_PATH-1] = '\0';
printf("conf = %s\n", confPath);
}

Expand Down