mirror of
https://github.com/dgis/emu48android
synced 2024-12-26 09:58:49 +01:00
This commit is contained in:
parent
7ec3193649
commit
81b3024034
4 changed files with 124 additions and 46 deletions
|
@ -2069,6 +2069,10 @@ BOOL emu48Start()
|
||||||
GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory),szCurrentDirectory);
|
GetCurrentDirectory(ARRAYSIZEOF(szCurrentDirectory),szCurrentDirectory);
|
||||||
ReadSettings();
|
ReadSettings();
|
||||||
|
|
||||||
|
_tcscpy(szCurrentDirectory, "");
|
||||||
|
_tcscpy(szRomDirectory, "assets/calculators/");
|
||||||
|
|
||||||
|
|
||||||
// running an instance of me?
|
// running an instance of me?
|
||||||
// if (bSingleInstance && (hWnd = FindWindow(MAKEINTATOM(classAtom),NULL)) != NULL)
|
// if (bSingleInstance && (hWnd = FindWindow(MAKEINTATOM(classAtom),NULL)) != NULL)
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -7,8 +7,6 @@
|
||||||
#define _CRTDBG_MAP_ALLOC
|
#define _CRTDBG_MAP_ALLOC
|
||||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||||
|
|
||||||
#include "win32-layer.h"
|
|
||||||
|
|
||||||
//#include <winsock2.h>
|
//#include <winsock2.h>
|
||||||
//#include <windows.h>
|
//#include <windows.h>
|
||||||
//#include <tchar.h>
|
//#include <tchar.h>
|
||||||
|
@ -24,6 +22,14 @@
|
||||||
//#include <conio.h>
|
//#include <conio.h>
|
||||||
//#include <crtdbg.h>
|
//#include <crtdbg.h>
|
||||||
|
|
||||||
|
#include <android/log.h>
|
||||||
|
#define LOG_TAG "NDK_NativeEmu48"
|
||||||
|
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))
|
||||||
|
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__))
|
||||||
|
|
||||||
|
#include "win32-layer.h"
|
||||||
|
|
||||||
|
|
||||||
#if !defined VERIFY
|
#if !defined VERIFY
|
||||||
#if defined _DEBUG
|
#if defined _DEBUG
|
||||||
#define VERIFY(f) _ASSERT(f)
|
#define VERIFY(f) _ASSERT(f)
|
||||||
|
|
|
@ -4,12 +4,14 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <android/asset_manager.h>
|
|
||||||
#include <android/asset_manager_jni.h>
|
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
|
|
||||||
HANDLE hWnd;
|
HANDLE hWnd;
|
||||||
LPTSTR szTitle;
|
LPTSTR szTitle;
|
||||||
|
LPTSTR szCurrentDirectorySet = NULL;
|
||||||
|
const TCHAR * assetsPrefix = _T("assets/"),
|
||||||
|
assetsPrefixLength = 7;
|
||||||
|
AAssetManager * assetManager;
|
||||||
|
|
||||||
|
|
||||||
DWORD GetCurrentDirectory(DWORD nBufferLength, LPTSTR lpBuffer) {
|
DWORD GetCurrentDirectory(DWORD nBufferLength, LPTSTR lpBuffer) {
|
||||||
|
@ -24,30 +26,42 @@ BOOL SetCurrentDirectory(LPCTSTR path)
|
||||||
if(path == NULL)
|
if(path == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
if(_tcsncmp(path, assetsPrefix, assetsPrefixLength / sizeof(TCHAR)) == 0)
|
||||||
|
szCurrentDirectorySet = path + assetsPrefixLength;
|
||||||
|
else
|
||||||
|
szCurrentDirectorySet = NULL;
|
||||||
|
|
||||||
return chdir(path);
|
return chdir(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
AAssetManager * assetManager;
|
|
||||||
|
|
||||||
HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPVOID lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, LPVOID hTemplateFile)
|
HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPVOID lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, LPVOID hTemplateFile)
|
||||||
{
|
{
|
||||||
if(strncmp(lpFileName, "assets/", 7) == 0) {
|
if(szCurrentDirectorySet || _tcsncmp(lpFileName, assetsPrefix, assetsPrefixLength / sizeof(TCHAR)) == 0) {
|
||||||
|
TCHAR szFileName[MAX_PATH];
|
||||||
AAsset* asset = AAssetManager_open(assetManager, "calculators/real48sx.kml", AASSET_MODE_STREAMING);
|
AAsset * asset = NULL;
|
||||||
char buf[BUFSIZ];
|
szFileName[0] = _T('\0');
|
||||||
int nb_read = 0;
|
if(szCurrentDirectorySet) {
|
||||||
nb_read = AAsset_read(asset, buf, BUFSIZ);
|
_tcscpy(szFileName, szCurrentDirectorySet);
|
||||||
AAsset_close(asset);
|
_tcscat(szFileName, lpFileName);
|
||||||
|
asset = AAssetManager_open(assetManager, szFileName, AASSET_MODE_STREAMING);
|
||||||
|
} else {
|
||||||
|
asset = AAssetManager_open(assetManager, lpFileName + assetsPrefixLength, AASSET_MODE_STREAMING);
|
||||||
|
}
|
||||||
|
if(asset) {
|
||||||
|
HANDLE handle = malloc(sizeof(_HANDLE));
|
||||||
|
handle->handleType = HANDLE_TYPE_FILE_ASSET;
|
||||||
|
handle->fileAsset = asset;
|
||||||
|
// char buf[BUFSIZ];
|
||||||
|
// int nb_read = 0;
|
||||||
|
// nb_read = AAsset_read(asset, buf, BUFSIZ);
|
||||||
|
// AAsset_close(asset);
|
||||||
// }
|
// }
|
||||||
// AAssetDir* assetDir = AAssetManager_openDir(assetManager, "");
|
// AAssetDir* assetDir = AAssetManager_openDir(assetManager, "");
|
||||||
// const char* filename = (const char*)NULL;
|
// const char* filename = (const char*)NULL;
|
||||||
// while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
|
// while ((filename = AAssetDir_getNextFileName(assetDir)) != NULL) {
|
||||||
// AAssetDir_close(assetDir);
|
// AAssetDir_close(assetDir);
|
||||||
HANDLE handle = malloc(sizeof(_HANDLE));
|
return handle;
|
||||||
handle->handleType = HANDLE_TYPE_FILE;
|
}
|
||||||
//handle->fileDescriptor = fd;
|
|
||||||
handle->fileIsAsset = TRUE;
|
|
||||||
return handle;
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
int flags = O_RDWR;
|
int flags = O_RDWR;
|
||||||
|
@ -88,7 +102,6 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||||
HANDLE handle = malloc(sizeof(_HANDLE));
|
HANDLE handle = malloc(sizeof(_HANDLE));
|
||||||
handle->handleType = HANDLE_TYPE_FILE;
|
handle->handleType = HANDLE_TYPE_FILE;
|
||||||
handle->fileDescriptor = fd;
|
handle->fileDescriptor = fd;
|
||||||
handle->fileIsAsset = FALSE;
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,13 +109,20 @@ HANDLE CreateFile(LPCTSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {
|
BOOL ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {
|
||||||
DWORD readByteCount = read(hFile->fileDescriptor, lpBuffer, nNumberOfBytesToRead);
|
DWORD readByteCount = 0;
|
||||||
|
if(hFile->handleType == HANDLE_TYPE_FILE) {
|
||||||
|
readByteCount = read(hFile->fileDescriptor, lpBuffer, nNumberOfBytesToRead);
|
||||||
|
} else if(hFile->handleType == HANDLE_TYPE_FILE_ASSET) {
|
||||||
|
readByteCount = AAsset_read(hFile->fileAsset, lpBuffer, nNumberOfBytesToRead);
|
||||||
|
}
|
||||||
if(lpNumberOfBytesRead)
|
if(lpNumberOfBytesRead)
|
||||||
*lpNumberOfBytesRead = readByteCount;
|
*lpNumberOfBytesRead = readByteCount;
|
||||||
return readByteCount >= 0;
|
return readByteCount >= 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) {
|
BOOL WriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped) {
|
||||||
|
if(hFile->handleType == HANDLE_TYPE_FILE_ASSET)
|
||||||
|
return FALSE;
|
||||||
size_t writenByteCount = write(hFile->fileDescriptor, lpBuffer, nNumberOfBytesToWrite);
|
size_t writenByteCount = write(hFile->fileDescriptor, lpBuffer, nNumberOfBytesToWrite);
|
||||||
if(lpNumberOfBytesWritten)
|
if(lpNumberOfBytesWritten)
|
||||||
*lpNumberOfBytesWritten = writenByteCount;
|
*lpNumberOfBytesWritten = writenByteCount;
|
||||||
|
@ -117,21 +137,34 @@ DWORD SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveH
|
||||||
moveMode = SEEK_CUR;
|
moveMode = SEEK_CUR;
|
||||||
else if(dwMoveMethod == FILE_END)
|
else if(dwMoveMethod == FILE_END)
|
||||||
moveMode = SEEK_END;
|
moveMode = SEEK_END;
|
||||||
int seekResult = lseek(hFile->fileDescriptor, lDistanceToMove, moveMode);
|
int seekResult = -1;
|
||||||
|
if(hFile->handleType == HANDLE_TYPE_FILE) {
|
||||||
|
seekResult = lseek(hFile->fileDescriptor, lDistanceToMove, moveMode);
|
||||||
|
} else if(hFile->handleType == HANDLE_TYPE_FILE_ASSET) {
|
||||||
|
seekResult = AAsset_seek64(hFile->fileAsset, lDistanceToMove, moveMode);
|
||||||
|
}
|
||||||
return seekResult < 0 ? INVALID_SET_FILE_POINTER : seekResult;
|
return seekResult < 0 ? INVALID_SET_FILE_POINTER : seekResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL SetEndOfFile(HANDLE hFile) {
|
BOOL SetEndOfFile(HANDLE hFile) {
|
||||||
|
if(hFile->handleType == HANDLE_TYPE_FILE_ASSET)
|
||||||
|
return FALSE;
|
||||||
off_t currentPosition = lseek(hFile->fileDescriptor, 0, SEEK_CUR);
|
off_t currentPosition = lseek(hFile->fileDescriptor, 0, SEEK_CUR);
|
||||||
int truncateResult = ftruncate(hFile->fileDescriptor, currentPosition);
|
int truncateResult = ftruncate(hFile->fileDescriptor, currentPosition);
|
||||||
return truncateResult == 0;
|
return truncateResult == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
|
DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
|
||||||
off_t currentPosition = lseek(hFile->fileDescriptor, 0, SEEK_CUR);
|
if(lpFileSizeHigh)
|
||||||
off_t fileLength = lseek(hFile->fileDescriptor, 0, SEEK_END) + 1;
|
*lpFileSizeHigh = 0;
|
||||||
lseek(hFile->fileDescriptor, currentPosition, SEEK_SET);
|
if(hFile->handleType == HANDLE_TYPE_FILE) {
|
||||||
return fileLength;
|
off_t currentPosition = lseek(hFile->fileDescriptor, 0, SEEK_CUR);
|
||||||
|
off_t fileLength = lseek(hFile->fileDescriptor, 0, SEEK_END) + 1;
|
||||||
|
lseek(hFile->fileDescriptor, currentPosition, SEEK_SET);
|
||||||
|
return fileLength;
|
||||||
|
} else if(hFile->handleType == HANDLE_TYPE_FILE_ASSET) {
|
||||||
|
return AAsset_getLength64(hFile->fileAsset);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//** https://www.ibm.com/developerworks/systems/library/es-MigratingWin32toLinux.html
|
//** https://www.ibm.com/developerworks/systems/library/es-MigratingWin32toLinux.html
|
||||||
|
@ -139,8 +172,13 @@ DWORD GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh) {
|
||||||
//https://www.ibm.com/developerworks/systems/library/es-win32linux-sem.html
|
//https://www.ibm.com/developerworks/systems/library/es-win32linux-sem.html
|
||||||
HANDLE CreateFileMapping(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName) {
|
HANDLE CreateFileMapping(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow, LPCSTR lpName) {
|
||||||
HANDLE handle = malloc(sizeof(_HANDLE));
|
HANDLE handle = malloc(sizeof(_HANDLE));
|
||||||
handle->handleType = HANDLE_TYPE_FILE_MAPPING;
|
if(hFile->handleType == HANDLE_TYPE_FILE) {
|
||||||
handle->fileDescriptor = hFile->fileDescriptor;
|
handle->handleType = HANDLE_TYPE_FILE_MAPPING;
|
||||||
|
handle->fileDescriptor = hFile->fileDescriptor;
|
||||||
|
} else if(hFile->handleType == HANDLE_TYPE_FILE_ASSET) {
|
||||||
|
handle->handleType = HANDLE_TYPE_FILE_MAPPING_ASSET;
|
||||||
|
handle->fileAsset = hFile->fileAsset;
|
||||||
|
}
|
||||||
handle->fileMappingSize = (dwMaximumSizeHigh << 32) & dwMaximumSizeLow;
|
handle->fileMappingSize = (dwMaximumSizeHigh << 32) & dwMaximumSizeLow;
|
||||||
handle->fileMappingAddress = NULL;
|
handle->fileMappingAddress = NULL;
|
||||||
return handle;
|
return handle;
|
||||||
|
@ -148,18 +186,28 @@ HANDLE CreateFileMapping(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttrib
|
||||||
|
|
||||||
//https://msdn.microsoft.com/en-us/library/Aa366761(v=VS.85).aspx
|
//https://msdn.microsoft.com/en-us/library/Aa366761(v=VS.85).aspx
|
||||||
LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap) {
|
LPVOID MapViewOfFile(HANDLE hFileMappingObject, DWORD dwDesiredAccess, DWORD dwFileOffsetHigh, DWORD dwFileOffsetLow, SIZE_T dwNumberOfBytesToMap) {
|
||||||
int prot = PROT_NONE;
|
off_t offset = (dwFileOffsetHigh << 32) & dwFileOffsetLow;
|
||||||
if(dwDesiredAccess & FILE_MAP_READ)
|
if(hFileMappingObject->handleType == HANDLE_TYPE_FILE_MAPPING) {
|
||||||
prot |= PROT_READ;
|
int prot = PROT_NONE;
|
||||||
if(dwDesiredAccess & FILE_MAP_WRITE)
|
if (dwDesiredAccess & FILE_MAP_READ)
|
||||||
prot |= PROT_WRITE;
|
prot |= PROT_READ;
|
||||||
off_t __offset = (dwFileOffsetHigh << 32) & dwFileOffsetLow;
|
if (dwDesiredAccess & FILE_MAP_WRITE)
|
||||||
hFileMappingObject->fileMappingAddress = mmap(NULL, hFileMappingObject->fileMappingSize, prot, MAP_PRIVATE, hFileMappingObject->fileDescriptor, __offset);
|
prot |= PROT_WRITE;
|
||||||
return hFileMappingObject->fileMappingAddress;
|
hFileMappingObject->fileMappingAddress = mmap(NULL, hFileMappingObject->fileMappingSize,
|
||||||
|
prot, MAP_PRIVATE,
|
||||||
|
hFileMappingObject->fileDescriptor, offset);
|
||||||
|
return hFileMappingObject->fileMappingAddress;
|
||||||
|
} else if(hFileMappingObject->handleType == HANDLE_TYPE_FILE_MAPPING_ASSET) {
|
||||||
|
if (dwDesiredAccess & FILE_MAP_WRITE)
|
||||||
|
return NULL;
|
||||||
|
return AAsset_getBuffer(hFileMappingObject->fileAsset) + offset;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://msdn.microsoft.com/en-us/library/aa366882(v=vs.85).aspx
|
// https://msdn.microsoft.com/en-us/library/aa366882(v=vs.85).aspx
|
||||||
BOOL UnmapViewOfFile(LPCVOID lpBaseAddress) {
|
BOOL UnmapViewOfFile(LPCVOID lpBaseAddress) {
|
||||||
|
//TODO for HANDLE_TYPE_FILE_MAPPING/HANDLE_TYPE_FILE_MAPPING_ASSET
|
||||||
int result = munmap(lpBaseAddress, -1);
|
int result = munmap(lpBaseAddress, -1);
|
||||||
return result == 0;
|
return result == 0;
|
||||||
}
|
}
|
||||||
|
@ -756,6 +804,9 @@ UINT GetDlgItemTextA(HWND hDlg, int nIDDlgItem, LPSTR lpString,int cchMax) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
BOOL SetDlgItemText(HWND hDlg, int nIDDlgItem, LPCSTR lpString) {
|
BOOL SetDlgItemText(HWND hDlg, int nIDDlgItem, LPCSTR lpString) {
|
||||||
|
if(nIDDlgItem == IDC_KMLLOG) {
|
||||||
|
LOGD("KML log:\r\n%s", lpString);
|
||||||
|
}
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -771,10 +822,10 @@ BOOL EndDialog(HWND hDlg, INT_PTR nResult) {
|
||||||
//TODO
|
//TODO
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
INT_PTR DialogBoxParam(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
//INT_PTR DialogBoxParam(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
||||||
//TODO
|
// //TODO
|
||||||
return NULL;
|
// return NULL;
|
||||||
}
|
//}
|
||||||
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData) {
|
HANDLE FindFirstFileA(LPCSTR lpFileName, LPWIN32_FIND_DATAA lpFindFileData) {
|
||||||
//TODO
|
//TODO
|
||||||
return INVALID_HANDLE_VALUE;
|
return INVALID_HANDLE_VALUE;
|
||||||
|
@ -800,10 +851,14 @@ PIDLIST_ABSOLUTE SHBrowseForFolderA(LPBROWSEINFOA lpbi) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
extern TCHAR szCurrentKml[MAX_PATH];
|
extern TCHAR szCurrentKml[MAX_PATH];
|
||||||
|
//extern TCHAR szLog[MAX_PATH];
|
||||||
INT_PTR DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
INT_PTR DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam) {
|
||||||
//TODO
|
//TODO
|
||||||
if(lpTemplateName == MAKEINTRESOURCE(IDD_CHOOSEKML)) {
|
if(lpTemplateName == MAKEINTRESOURCE(IDD_CHOOSEKML)) {
|
||||||
lstrcpy(szCurrentKml, "assets/calculators/real48sx.kml");
|
lstrcpy(szCurrentKml, "assets/calculators/real48sx.kml");
|
||||||
|
} else if(lpTemplateName == MAKEINTRESOURCE(IDD_KMLLOG)) {
|
||||||
|
//LOGD(szLog);
|
||||||
|
lpDialogFunc(NULL, WM_INITDIALOG, 0, 0);
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <android/asset_manager.h>
|
||||||
|
|
||||||
#ifndef __OBJC__
|
#ifndef __OBJC__
|
||||||
typedef signed char BOOL; // deliberately same type as defined in objc
|
typedef signed char BOOL; // deliberately same type as defined in objc
|
||||||
|
@ -52,7 +53,9 @@ typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
|
||||||
|
|
||||||
enum HANDLE_TYPE {
|
enum HANDLE_TYPE {
|
||||||
HANDLE_TYPE_FILE = 1,
|
HANDLE_TYPE_FILE = 1,
|
||||||
|
HANDLE_TYPE_FILE_ASSET,
|
||||||
HANDLE_TYPE_FILE_MAPPING,
|
HANDLE_TYPE_FILE_MAPPING,
|
||||||
|
HANDLE_TYPE_FILE_MAPPING_ASSET,
|
||||||
HANDLE_TYPE_EVENT,
|
HANDLE_TYPE_EVENT,
|
||||||
HANDLE_TYPE_THREAD,
|
HANDLE_TYPE_THREAD,
|
||||||
};
|
};
|
||||||
|
@ -60,7 +63,8 @@ typedef struct {
|
||||||
int handleType;
|
int handleType;
|
||||||
|
|
||||||
int fileDescriptor;
|
int fileDescriptor;
|
||||||
BOOL fileIsAsset;
|
|
||||||
|
AAsset* fileAsset;
|
||||||
|
|
||||||
size_t fileMappingSize;
|
size_t fileMappingSize;
|
||||||
void* fileMappingAddress;
|
void* fileMappingAddress;
|
||||||
|
@ -748,7 +752,13 @@ extern BOOL CheckDlgButton(HWND hDlg, int nIDButton, UINT uCheck);
|
||||||
extern UINT IsDlgButtonChecked(HWND hDlg, int nIDButton);
|
extern UINT IsDlgButtonChecked(HWND hDlg, int nIDButton);
|
||||||
extern BOOL EndDialog(HWND hDlg, INT_PTR nResult);
|
extern BOOL EndDialog(HWND hDlg, INT_PTR nResult);
|
||||||
typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
|
typedef INT_PTR (CALLBACK* DLGPROC)(HWND, UINT, WPARAM, LPARAM);
|
||||||
extern INT_PTR DialogBoxParam(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
|
//extern INT_PTR DialogBoxParam(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
|
||||||
|
extern INT_PTR DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
|
||||||
|
#define DialogBoxA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
|
||||||
|
DialogBoxParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
|
||||||
|
#define DialogBox DialogBoxA
|
||||||
|
#define DialogBoxParam DialogBoxParamA
|
||||||
|
|
||||||
#define MAKEINTRESOURCE(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
|
#define MAKEINTRESOURCE(i) ((LPSTR)((ULONG_PTR)((WORD)(i))))
|
||||||
typedef struct _FILETIME {
|
typedef struct _FILETIME {
|
||||||
DWORD dwLowDateTime;
|
DWORD dwLowDateTime;
|
||||||
|
@ -823,11 +833,6 @@ HRESULT SHGetMalloc(IMalloc **ppMalloc); // CoGetMalloc(MEMCTX_TASK,ppMalloc)
|
||||||
#define PIDLIST_ABSOLUTE LPITEMIDLIST
|
#define PIDLIST_ABSOLUTE LPITEMIDLIST
|
||||||
extern PIDLIST_ABSOLUTE SHBrowseForFolderA(LPBROWSEINFOA lpbi);
|
extern PIDLIST_ABSOLUTE SHBrowseForFolderA(LPBROWSEINFOA lpbi);
|
||||||
#define SHBrowseForFolder SHBrowseForFolderA
|
#define SHBrowseForFolder SHBrowseForFolderA
|
||||||
extern INT_PTR DialogBoxParamA(HINSTANCE hInstance, LPCSTR lpTemplateName, HWND hWndParent, DLGPROC lpDialogFunc, LPARAM dwInitParam);
|
|
||||||
#define DialogBoxA(hInstance, lpTemplate, hWndParent, lpDialogFunc) \
|
|
||||||
DialogBoxParamA(hInstance, lpTemplate, hWndParent, lpDialogFunc, 0L)
|
|
||||||
#define DialogBox DialogBoxA
|
|
||||||
|
|
||||||
#define LANG_NEUTRAL 0x00
|
#define LANG_NEUTRAL 0x00
|
||||||
#define SUBLANG_NEUTRAL 0x00
|
#define SUBLANG_NEUTRAL 0x00
|
||||||
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
|
#define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff)
|
||||||
|
@ -867,6 +872,10 @@ extern int lstrcmp(LPCWSTR lpString1, LPCWSTR lpString2);
|
||||||
|
|
||||||
extern int lstrcmpi(LPCWSTR lpString1, LPCWSTR lpString2);
|
extern int lstrcmpi(LPCWSTR lpString1, LPCWSTR lpString2);
|
||||||
#define _tcstoul wcstoul
|
#define _tcstoul wcstoul
|
||||||
|
#define _tcsncmp wcsncmp
|
||||||
|
#define _tcslen wcslen
|
||||||
|
#define _tcscpy wcscpy
|
||||||
|
#define _tcscat wcscat
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
|
@ -884,6 +893,10 @@ extern int lstrcmp(LPCSTR lpString1, LPCSTR lpString2);
|
||||||
#define _tcsncmp strncmp
|
#define _tcsncmp strncmp
|
||||||
extern int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);
|
extern int lstrcmpi(LPCSTR lpString1, LPCSTR lpString2);
|
||||||
#define _tcstoul strtoul
|
#define _tcstoul strtoul
|
||||||
|
#define _tcsncmp strncmp
|
||||||
|
#define _tcslen strlen
|
||||||
|
#define _tcscpy strcpy
|
||||||
|
#define _tcscat strcat
|
||||||
|
|
||||||
|
|
||||||
#endif // !UNICODE
|
#endif // !UNICODE
|
||||||
|
|
Loading…
Reference in a new issue