mirror of
https://github.com/dgis/emu48android
synced 2024-12-27 09:58:46 +01:00
- Cleanup the code
- Allow to build with the command line
This commit is contained in:
parent
fac5057e93
commit
539e09e4a5
6 changed files with 89 additions and 65 deletions
37
ReadMe.txt
37
ReadMe.txt
|
@ -23,7 +23,7 @@ QUICK START
|
||||||
|
|
||||||
NOTES
|
NOTES
|
||||||
|
|
||||||
- When using a custom KML script by selecting a folder, you must take care of the case sensitivity of its dependencies.
|
- When using a custom KML script by selecting a folder, you must take care of the case sensitivity of its dependency files.
|
||||||
|
|
||||||
|
|
||||||
NOT WORKING YET
|
NOT WORKING YET
|
||||||
|
@ -86,8 +86,10 @@ You should have received a copy of the GNU General Public License along with thi
|
||||||
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
Note: some included files are not covered by the GPL; these include ROM image files (copyrighted by HP), KML files and faceplate images (copyrighted by their authors).
|
||||||
The Eric's Real scripts ("real*.kml" and "real*.bmp") are embedded in this application with the kind permission of Eric Rechlin.
|
The Eric's Real scripts ("real*.kml" and "real*.bmp") are embedded in this application with the kind permission of Eric Rechlin.
|
||||||
|
|
||||||
|
|
||||||
TODO
|
TODO
|
||||||
- Sometimes, it seems in authentic calculator slow speed and it should not be.
|
|
||||||
|
- Sometimes, it seems to be in authentic calculator slow speed and it should not be.
|
||||||
- Add a separation between the pixels (Suggestion from Jaime Meza)
|
- Add a separation between the pixels (Suggestion from Jaime Meza)
|
||||||
- Sometimes the "busy" annunciator gets stuck
|
- Sometimes the "busy" annunciator gets stuck
|
||||||
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?)
|
- Add KML script loading dependencies fallback to the inner ROM (and may be KML include?)
|
||||||
|
@ -95,3 +97,34 @@ TODO
|
||||||
- Add a true fullscreen mode under the status bar and the bottom buttons
|
- Add a true fullscreen mode under the status bar and the bottom buttons
|
||||||
- Improve the access to the menu
|
- Improve the access to the menu
|
||||||
- Change the logo following the template
|
- Change the logo following the template
|
||||||
|
|
||||||
|
|
||||||
|
BUILD
|
||||||
|
|
||||||
|
Emu48 for Android is built with Android Studio 3.3 (2019).
|
||||||
|
And to generate a installable APK file with a real Android device, it MUST be signed.
|
||||||
|
|
||||||
|
Either use Android Studio:
|
||||||
|
* In menu "Build"
|
||||||
|
* Select "Generate Signed Bundle / APK..."
|
||||||
|
* Select "APK", then "Next"
|
||||||
|
* "Create new..." (or use an existing key store file)
|
||||||
|
* Enter "Key store password", "Key alias" and "Key password", then "Next"
|
||||||
|
* Select a "Destination folder:"
|
||||||
|
* Select the "Build Variants:" "release"
|
||||||
|
* Select the "Signature Versions:" "V1" (V1 only)
|
||||||
|
* Finish
|
||||||
|
|
||||||
|
Or in the command line, build the signed APK:
|
||||||
|
* In the root folder, create a keystore.jks file with:
|
||||||
|
** keytool -genkey -keystore ./keystore.jks -keyalg RSA -validity 9125 -alias key0
|
||||||
|
** keytool -genkeypair -v -keystore ./keystore.jks -keyalg RSA -validity 9125 -alias key0
|
||||||
|
* create the file ./keystore.properties , with the following properties:
|
||||||
|
storeFile=../keystore.jks
|
||||||
|
storePassword=myPassword
|
||||||
|
keyAlias=key0
|
||||||
|
keyPassword=myPassword
|
||||||
|
* gradlew build
|
||||||
|
* The APK should be in the folder app/build/outputs/apk/release
|
||||||
|
|
||||||
|
Then, you should be able to use this fresh APK file with an Android device.
|
||||||
|
|
|
@ -1,5 +1,32 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
|
|
||||||
|
// Create a variable called keystorePropertiesFile, and initialize it to your
|
||||||
|
// keystore.properties file, in the rootProject folder.
|
||||||
|
def keystorePropertiesFile = rootProject.file("keystore.properties")
|
||||||
|
def keystoreProperties = new Properties()
|
||||||
|
def canSign = false
|
||||||
|
if(keystorePropertiesFile.exists()) {
|
||||||
|
canSign = true
|
||||||
|
println("The release flavor will signed in app/build/outputs/apk/release/app-release.apk")
|
||||||
|
|
||||||
|
// Load your keystore.properties file into the keystoreProperties object.
|
||||||
|
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
|
||||||
|
} else {
|
||||||
|
println("""
|
||||||
|
The keystore.properties file is not found, so, you will not be able to install an unsigned APK in an Android device.
|
||||||
|
Please, in the root folder, create a keystore.jks file with the command:
|
||||||
|
|
||||||
|
keytool -genkey -keystore ./keystore.jks -keyalg RSA -validity 9125 -alias key0
|
||||||
|
|
||||||
|
and create the file ./keystore.properties , with the following properties:
|
||||||
|
|
||||||
|
storeFile=../keystore.jks
|
||||||
|
storePassword=myPassword
|
||||||
|
keyAlias=key0
|
||||||
|
keyPassword=myPassword
|
||||||
|
""")
|
||||||
|
}
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 28
|
compileSdkVersion 28
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
|
@ -17,10 +44,29 @@ android {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if(project.hasProperty("MyProject.properties")
|
||||||
|
// && new File(project.property("MyProject.properties")).exists()) {
|
||||||
|
|
||||||
|
if(canSign) {
|
||||||
|
signingConfigs {
|
||||||
|
release {
|
||||||
|
// storeFile new File(keystoreProperties['storeFile'])
|
||||||
|
storeFile file(keystoreProperties['storeFile'])
|
||||||
|
storePassword keystoreProperties['storePassword']
|
||||||
|
keyAlias keystoreProperties['keyAlias']
|
||||||
|
keyPassword keystoreProperties['keyPassword']
|
||||||
|
v1SigningEnabled true
|
||||||
|
v2SigningEnabled false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
minifyEnabled false
|
minifyEnabled false
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
|
if(canSign) {
|
||||||
|
signingConfig signingConfigs.release
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
externalNativeBuild {
|
externalNativeBuild {
|
||||||
|
|
|
@ -37,12 +37,6 @@ extern void buttonUp(int x, int y);
|
||||||
extern void keyDown(int virtKey);
|
extern void keyDown(int virtKey);
|
||||||
extern void keyUp(int virtKey);
|
extern void keyUp(int virtKey);
|
||||||
|
|
||||||
extern void OnBackupSave();
|
|
||||||
extern void OnBackupRestore();
|
|
||||||
extern void OnBackupDelete();
|
|
||||||
|
|
||||||
|
|
||||||
//JNIEnv *getJNIEnvironment();
|
|
||||||
|
|
||||||
JavaVM *java_machine;
|
JavaVM *java_machine;
|
||||||
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||||
|
@ -283,7 +277,7 @@ JNIEXPORT void JNICALL Java_org_emulator_forty_eight_NativeLib_start(JNIEnv *env
|
||||||
|
|
||||||
// read emulator settings
|
// read emulator settings
|
||||||
GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory),szCurrentDirectory);
|
GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory),szCurrentDirectory);
|
||||||
ReadSettings();
|
//ReadSettings();
|
||||||
|
|
||||||
_tcscpy(szCurrentDirectory, "");
|
_tcscpy(szCurrentDirectory, "");
|
||||||
_tcscpy(szEmuDirectory, "assets/calculators/");
|
_tcscpy(szEmuDirectory, "assets/calculators/");
|
||||||
|
|
|
@ -24,7 +24,6 @@ size_t assetsPrefixLength;
|
||||||
const TCHAR * contentScheme = _T("content://");
|
const TCHAR * contentScheme = _T("content://");
|
||||||
size_t contentSchemeLength;
|
size_t contentSchemeLength;
|
||||||
const TCHAR * documentScheme = _T("document:");
|
const TCHAR * documentScheme = _T("document:");
|
||||||
//static HDC mainPaintDC = NULL;
|
|
||||||
struct timerEvent {
|
struct timerEvent {
|
||||||
BOOL valid;
|
BOOL valid;
|
||||||
int timerId;
|
int timerId;
|
||||||
|
@ -208,7 +207,7 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return INVALID_HANDLE_VALUE;
|
return (HANDLE) INVALID_HANDLE_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {
|
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {
|
||||||
|
@ -338,27 +337,7 @@ BOOL UnmapViewOfFile(LPCVOID lpBaseAddress) {
|
||||||
for (int i = 0; i < MAX_FILE_MAPPING_HANDLE; ++i) {
|
for (int i = 0; i < MAX_FILE_MAPPING_HANDLE; ++i) {
|
||||||
HANDLE fileMappingHandle = fileMappingHandles[i];
|
HANDLE fileMappingHandle = fileMappingHandles[i];
|
||||||
if(fileMappingHandle && lpBaseAddress == fileMappingHandle->fileMappingAddress) {
|
if(fileMappingHandle && lpBaseAddress == fileMappingHandle->fileMappingAddress) {
|
||||||
// Only save the file manually (for Port2 actually)
|
// Only save the file manually (for Port2 actually)
|
||||||
// if(fileMappingHandle->fileMappingProtect == PAGE_READWRITE) {
|
|
||||||
// if(fileMappingHandle->handleType == HANDLE_TYPE_FILE_MAPPING) {
|
|
||||||
// // munmap does not seem to work, so:
|
|
||||||
// size_t numberOfBytesToWrite = fileMappingHandle->fileMappingSize - fileMappingHandle->fileMappingOffset;
|
|
||||||
// off_t currentPosition = lseek(fileMappingHandle->fileDescriptor, 0, SEEK_CUR);
|
|
||||||
// lseek(fileMappingHandle->fileDescriptor, fileMappingHandle->fileMappingOffset, SEEK_SET);
|
|
||||||
// write(fileMappingHandle->fileDescriptor, fileMappingHandle->fileMappingAddress, numberOfBytesToWrite);
|
|
||||||
// lseek(fileMappingHandle->fileDescriptor, currentPosition, SEEK_SET);
|
|
||||||
// result = munmap(lpBaseAddress, fileMappingHandle->fileMappingSize);
|
|
||||||
// } else if(fileMappingHandle->handleType == HANDLE_TYPE_FILE_MAPPING_CONTENT) {
|
|
||||||
// size_t numberOfBytesToWrite = fileMappingHandle->fileMappingSize - fileMappingHandle->fileMappingOffset;
|
|
||||||
// off_t currentPosition = lseek(fileMappingHandle->fileDescriptor, 0, SEEK_CUR);
|
|
||||||
// lseek(fileMappingHandle->fileDescriptor, fileMappingHandle->fileMappingOffset, SEEK_SET);
|
|
||||||
// write(fileMappingHandle->fileDescriptor, fileMappingHandle->fileMappingAddress, numberOfBytesToWrite);
|
|
||||||
// lseek(fileMappingHandle->fileDescriptor, currentPosition, SEEK_SET);
|
|
||||||
// } else if(fileMappingHandle->handleType == HANDLE_TYPE_FILE_MAPPING_ASSET) {
|
|
||||||
// // No need to unmap
|
|
||||||
// result = 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
fileMappingHandles[i] = NULL;
|
fileMappingHandles[i] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -761,21 +740,6 @@ BOOL WritePrivateProfileString(LPCTSTR lpAppName, LPCTSTR lpKeyName, LPCTSTR lpS
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
void SetTimer(void *, TimerType id, int msec, void *)
|
|
||||||
{
|
|
||||||
switch(id) {
|
|
||||||
case TIME_SHOW:
|
|
||||||
doc_manager->getCurrent()->SetShowTimer(msec);
|
|
||||||
break;
|
|
||||||
case TIME_NEXT:
|
|
||||||
doc_manager->getCurrent()->SetNextTimer(msec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
HGLOBAL WINAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes) {
|
HGLOBAL WINAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes) {
|
||||||
return malloc(dwBytes);
|
return malloc(dwBytes);
|
||||||
}
|
}
|
||||||
|
@ -876,14 +840,6 @@ MMRESULT waveOutOpen(LPHWAVEOUT phwo, UINT uDeviceID, LPCWAVEFORMATEX pwfx, DWOR
|
||||||
handle->pwfx = (WAVEFORMATEX *) pwfx;
|
handle->pwfx = (WAVEFORMATEX *) pwfx;
|
||||||
handle->uDeviceID = uDeviceID;
|
handle->uDeviceID = uDeviceID;
|
||||||
|
|
||||||
|
|
||||||
//SLObjectItf engineObject = NULL;
|
|
||||||
//SLObjectItf outputMixObject = NULL;
|
|
||||||
//SLObjectItf bqPlayerObject = NULL;
|
|
||||||
//pthread_mutex_t audioEngineLock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
//handle->audioEngineLock = PTHREAD_MUTEX_INITIALIZER;
|
|
||||||
|
|
||||||
|
|
||||||
SLresult result;
|
SLresult result;
|
||||||
|
|
||||||
// create engine
|
// create engine
|
||||||
|
@ -1674,17 +1630,14 @@ BOOL GdiFlush(void) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
HDC BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint) {
|
HDC BeginPaint(HWND hWnd, LPPAINTSTRUCT lpPaint) {
|
||||||
//hWindowDC;
|
|
||||||
// if(!mainPaintDC)
|
|
||||||
// mainPaintDC = CreateCompatibleDC(NULL);
|
|
||||||
if(lpPaint) {
|
if(lpPaint) {
|
||||||
memset(lpPaint, 0, sizeof(PAINTSTRUCT));
|
memset(lpPaint, 0, sizeof(PAINTSTRUCT));
|
||||||
lpPaint->fErase = TRUE;
|
lpPaint->fErase = TRUE;
|
||||||
lpPaint->hdc = hWindowDC; //mainPaintDC;
|
lpPaint->hdc = hWindowDC;
|
||||||
lpPaint->rcPaint.right = (short) nBackgroundW; //androidBitmapInfo.width; // - 1;
|
lpPaint->rcPaint.right = (short) nBackgroundW;
|
||||||
lpPaint->rcPaint.bottom = (short) nBackgroundH; //androidBitmapInfo.height; // - 1;
|
lpPaint->rcPaint.bottom = (short) nBackgroundH;
|
||||||
}
|
}
|
||||||
return hWindowDC; //mainPaintDC;
|
return hWindowDC;
|
||||||
}
|
}
|
||||||
BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint) {
|
BOOL EndPaint(HWND hWnd, CONST PAINTSTRUCT *lpPaint) {
|
||||||
mainViewUpdateCallback();
|
mainViewUpdateCallback();
|
||||||
|
|
|
@ -13,5 +13,3 @@ org.gradle.jvmargs=-Xmx1536m
|
||||||
# This option should only be used with decoupled projects. More details, visit
|
# This option should only be used with decoupled projects. More details, visit
|
||||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||||
# org.gradle.parallel=true
|
# org.gradle.parallel=true
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue