From 3187a1fe497f6b4b52d503804abd1454de946e19 Mon Sep 17 00:00:00 2001 From: dgis Date: Wed, 4 Mar 2020 08:30:01 +0100 Subject: [PATCH] Fix #11 issues with Linux build --- app/src/main/cpp/core/apple.c | 4 +- app/src/main/cpp/core/engine.c | 2 +- app/src/main/cpp/core/mops.c | 2 +- app/src/main/cpp/core/opcodes.c | 4 +- app/src/main/cpp/win32-layer.c | 46 +++++++++++++++++-- .../emulator/calculator/PrinterSimulator.java | 2 + 6 files changed, 51 insertions(+), 9 deletions(-) diff --git a/app/src/main/cpp/core/apple.c b/app/src/main/cpp/core/apple.c index ddfd2ff..348cac6 100644 --- a/app/src/main/cpp/core/apple.c +++ b/app/src/main/cpp/core/apple.c @@ -4,7 +4,7 @@ * This file is part of Emu48 * * Copyright (C) 2005 CdB for HP - * Copyright (C) 2006 Christoph Gießelink + * Copyright (C) 2006 Christoph Gie�elink * */ #include "pch.h" @@ -20,7 +20,7 @@ #pragma intrinsic(memset,memcpy) -#include "Ops.h" +#include "ops.h" // // ROM buffer access functions diff --git a/app/src/main/cpp/core/engine.c b/app/src/main/cpp/core/engine.c index 33e20ba..62c772c 100644 --- a/app/src/main/cpp/core/engine.c +++ b/app/src/main/cpp/core/engine.c @@ -73,7 +73,7 @@ static DWORD dwOldCyc; // cpu cycles at last event static DWORD dwSpeedRef; // timer value at last event static DWORD dwTickRef; // sample timer ticks -#include "Ops.h" +#include "ops.h" // save last instruction in circular instruction buffer static __inline VOID SaveInstrAddr(DWORD dwAddr) diff --git a/app/src/main/cpp/core/mops.c b/app/src/main/cpp/core/mops.c index 4cf0aee..9835e38 100644 --- a/app/src/main/cpp/core/mops.c +++ b/app/src/main/cpp/core/mops.c @@ -9,7 +9,7 @@ #include "pch.h" #include "Emu48.h" #include "ops.h" -#include "opcodes.h" +#include "Opcodes.h" #include "io.h" #include "i28f160.h" // flash support diff --git a/app/src/main/cpp/core/opcodes.c b/app/src/main/cpp/core/opcodes.c index 1430c80..74099d4 100644 --- a/app/src/main/cpp/core/opcodes.c +++ b/app/src/main/cpp/core/opcodes.c @@ -4,7 +4,7 @@ * This file is part of Emu48 * * Copyright (C) 1995 Sebastien Carlier - * Copyright (C) 1999 Christoph Gießelink + * Copyright (C) 1999 Christoph Gie�elink * */ #include "pch.h" @@ -25,7 +25,7 @@ #pragma intrinsic(memset,memcpy) -#include "Ops.h" +#include "ops.h" // Fields start and length UINT F_s[16] = {0/*P*/,0,2,0,15,3,0,0,0,0,0,0,0,0,0,0}; diff --git a/app/src/main/cpp/win32-layer.c b/app/src/main/cpp/win32-layer.c index 40bd0dd..b976521 100644 --- a/app/src/main/cpp/win32-layer.c +++ b/app/src/main/cpp/win32-layer.c @@ -2981,14 +2981,54 @@ void _wmakepath(wchar_t _Buffer, wchar_t const* _Drive, wchar_t const* _Dir, wch int WINAPI wvsprintf(LPSTR arg1, LPCSTR arg2, va_list arglist) { return vsprintf(arg1, arg2, arglist); } -DWORD GetFullPathName(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart) { return 0; } +const char pathSeparator = +#ifdef _WIN32 + '\\'; +#else + '/'; +#endif + +DWORD GetFullPathName(LPCSTR lpFileName, DWORD nBufferLength, LPSTR lpBuffer, LPSTR* lpFilePart) { + lstrcpyn(lpBuffer, lpFileName, nBufferLength); + if(lpFilePart != NULL) { + *lpFilePart = strrchr(lpBuffer, pathSeparator); + if(*lpFilePart != NULL) + (*lpFilePart)++; + } + return lstrlen(lpBuffer); +} LPSTR lstrcpyn(LPSTR lpString1, LPCSTR lpString2,int iMaxLength) { return strcpy(lpString1, lpString2); } LPSTR lstrcat(LPSTR lpString1, LPCSTR lpString2) { - return NULL; + return strcat(lpString1, lpString2); +} +void __cdecl _splitpath(const char * _FullPath, char* _Drive, char* _Dir, char* _Filename, char* _Ext) { + if (_Drive) + _Drive[0] = 0; + char * filePart = strrchr(_FullPath, pathSeparator); + if(_Dir) { + if(filePart != NULL) { + strncpy(_Dir, _FullPath, (int)(filePart - _FullPath)); + } else + _Dir[0] = 0; + } + if(_Filename) { + if(filePart != NULL) { + strcpy(_Filename, filePart + 1); + } else + _Filename[0] = 0; + } + if(_Ext) { + _Ext[0] = 0; + if(_Filename) { + char * extPart = strrchr(_Filename, '.'); + if (extPart != NULL) { + strcpy(_Ext, extPart + 1); + } + } + } } -void __cdecl _splitpath(char const* _FullPath, char* _Drive, char* _Dir, char* _Filename, char* _Ext) {} int WINAPI lstrcmp(LPCSTR lpString1, LPCSTR lpString2) { return strcmp(lpString1, lpString2); } diff --git a/app/src/main/java/org/emulator/calculator/PrinterSimulator.java b/app/src/main/java/org/emulator/calculator/PrinterSimulator.java index a12f304..2d953a4 100644 --- a/app/src/main/java/org/emulator/calculator/PrinterSimulator.java +++ b/app/src/main/java/org/emulator/calculator/PrinterSimulator.java @@ -51,6 +51,8 @@ public class PrinterSimulator { } catch(Exception ex) { Log.d(TAG, "Cannot get the MaximumTextureSize (Set default to 2048). Error: " + ex.getMessage()); } + if(maxBitmapHeight == 0) + maxBitmapHeight = 1024; maxBitmapHeight = Math.min(maxBitmapHeight, 8192); //32768); MAXPRTLINES = maxBitmapHeight / LINE_HEIGHT;