summaryrefslogtreecommitdiffstats
path: root/board/MAI/bios_emulator/scitech/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'board/MAI/bios_emulator/scitech/src/common')
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aabeos.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aados.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aalib.c52
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aalinux.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aaos2.c36
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aaqnx.c14
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aartt.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aasmx.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aavxd.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/aawin32.c96
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/agplib.c67
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/center.c33
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/cmdline.c342
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gabeos.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gados.c3
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/galib.c49
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/galinux.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gantdrv.c9
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gaos2.c36
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gaqnx.c22
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gartt.c8
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gasmx.c2
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gavxd.c9
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gawin32.c107
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/gtfcalc.c294
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/libcimp.c239
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/peloader.c363
-rw-r--r--board/MAI/bios_emulator/scitech/src/common/vesavbe.c514
28 files changed, 1189 insertions, 1198 deletions
diff --git a/board/MAI/bios_emulator/scitech/src/common/aabeos.c b/board/MAI/bios_emulator/scitech/src/common/aabeos.c
index ba8645945b..ad5698a406 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aabeos.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aabeos.c
@@ -70,7 +70,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -82,11 +82,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aados.c b/board/MAI/bios_emulator/scitech/src/common/aados.c
index e994f938eb..342d2f33a4 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aados.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aados.c
@@ -49,7 +49,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aalib.c b/board/MAI/bios_emulator/scitech/src/common/aalib.c
index 84bf7b3d8f..5003b22291 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aalib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aalib.c
@@ -100,35 +100,35 @@ static ibool LoadDriver(void)
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
_AA_exports.dwSize = sizeof(_AA_exports);
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,false)) == NULL)
- return false;
+ return false;
if ((AA_initLibrary = (AA_initLibrary_t)PE_getProcAddress(hModBPD,"_AA_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((aaExp = AA_initLibrary(bpdpath,filename,&_PM_imports,&_N_imports,&_AA_imports)) == NULL)
- PM_fatalError("AA_initLibrary failed!\n");
+ PM_fatalError("AA_initLibrary failed!\n");
/* Initialize all default imports to point to fatal error handler
* for upwards compatibility, and copy the exported functions.
*/
max = sizeof(_AA_exports)/sizeof(AA_initLibrary_t);
for (i = 0,p = (ulong*)&_AA_exports; i < max; i++)
- *p++ = (ulong)_AA_fatalErrorHandler;
+ *p++ = (ulong)_AA_fatalErrorHandler;
memcpy(&_AA_exports,aaExp,MIN(sizeof(_AA_exports),aaExp->dwSize));
loaded = true;
return true;
@@ -143,7 +143,7 @@ static ibool LoadDriver(void)
int NAPI AA_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return _AA_exports.AA_status();
}
@@ -152,7 +152,7 @@ const char * NAPI AA_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return _AA_exports.AA_errorMsg(status);
}
@@ -160,7 +160,7 @@ const char * NAPI AA_errorMsg(
int NAPI AA_getDaysLeft(void)
{
if (!LoadDriver())
- return -1;
+ return -1;
return _AA_exports.AA_getDaysLeft();
}
@@ -168,7 +168,7 @@ int NAPI AA_getDaysLeft(void)
int NAPI AA_registerLicense(uchar *license)
{
if (!LoadDriver())
- return 0;
+ return 0;
return _AA_exports.AA_registerLicense(license);
}
@@ -176,7 +176,7 @@ int NAPI AA_registerLicense(uchar *license)
int NAPI AA_enumerateDevices(void)
{
if (!LoadDriver())
- return 0;
+ return 0;
return _AA_exports.AA_enumerateDevices();
}
@@ -184,7 +184,7 @@ int NAPI AA_enumerateDevices(void)
AA_devCtx * NAPI AA_loadDriver(N_int32 deviceIndex)
{
if (!LoadDriver())
- return NULL;
+ return NULL;
return _AA_exports.AA_loadDriver(deviceIndex);
}
#endif
@@ -211,15 +211,15 @@ void NAPI _OS_delay(
LZTimerObject tm;
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- if (!inited) {
- ZTimerInit();
- inited = true;
- }
- LZTimerOnExt(&tm);
- while (LZTimerLapExt(&tm) < microSeconds)
- ;
- LZTimerOnExt(&tm);
- }
+ if (!inited) {
+ ZTimerInit();
+ inited = true;
+ }
+ LZTimerOnExt(&tm);
+ while (LZTimerLapExt(&tm) < microSeconds)
+ ;
+ LZTimerOnExt(&tm);
+ }
else
- _OS_delay8253(microSeconds);
+ _OS_delay8253(microSeconds);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aalinux.c b/board/MAI/bios_emulator/scitech/src/common/aalinux.c
index 4385b23e4f..d3d468ed0f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aalinux.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aalinux.c
@@ -72,7 +72,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -84,11 +84,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aaos2.c b/board/MAI/bios_emulator/scitech/src/common/aaos2.c
index 486b96a9c0..0ec8c9fcf1 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aaos2.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aaos2.c
@@ -65,25 +65,25 @@ GA_sharedInfo * NAPI GA_getSharedInfo(
/* Open our helper device driver */
if (DosOpen(PMHELP_NAME,&hSDDHelp,&result,0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL))
- PM_fatalError("Unable to open SDDHELP$ helper device driver!");
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL))
+ PM_fatalError("Unable to open SDDHELP$ helper device driver!");
outLen = sizeof(result);
DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,PMHELP_GETSHAREDINFO,
- NULL, 0, NULL,
- &result, outLen, &outLen);
+ NULL, 0, NULL,
+ &result, outLen, &outLen);
DosClose(hSDDHelp);
if (result) {
- /* We have found the shared Nucleus packet. Because not all processes
- * map to SDDPMI.DLL, we need to ensure that we connect to this
- * DLL so that it gets mapped into our address space (that is
- * where the shared Nucleus packet is located). Simply doing a
- * DosLoadModule on it is enough for this.
- */
- HMODULE hModSDDPMI;
- char buf[80];
- DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
- }
+ /* We have found the shared Nucleus packet. Because not all processes
+ * map to SDDPMI.DLL, we need to ensure that we connect to this
+ * DLL so that it gets mapped into our address space (that is
+ * where the shared Nucleus packet is located). Simply doing a
+ * DosLoadModule on it is enough for this.
+ */
+ HMODULE hModSDDPMI;
+ char buf[80];
+ DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
+ }
return (GA_sharedInfo*)result;
}
@@ -106,7 +106,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -118,7 +118,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- DosTmrQueryTime((QWORD*)value);
+ DosTmrQueryTime((QWORD*)value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aaqnx.c b/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
index 2e26c9afa6..13531be99f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aaqnx.c
@@ -72,7 +72,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -84,12 +84,12 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timespec ts;
+ struct timespec ts;
- clock_gettime(CLOCK_REALTIME, &ts);
- value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
- value->high = 0;
- }
+ clock_gettime(CLOCK_REALTIME, &ts);
+ value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aartt.c b/board/MAI/bios_emulator/scitech/src/common/aartt.c
index 17a06b531c..1a5a67a4e9 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aartt.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aartt.c
@@ -71,9 +71,9 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
return false;
}
@@ -85,5 +85,5 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aasmx.c b/board/MAI/bios_emulator/scitech/src/common/aasmx.c
index 56cbd5b888..163060f717 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aasmx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aasmx.c
@@ -68,7 +68,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aavxd.c b/board/MAI/bios_emulator/scitech/src/common/aavxd.c
index 295533db39..221b02bd9b 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aavxd.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aavxd.c
@@ -71,8 +71,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -84,7 +84,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- VTD_Get_Real_Time(&value->high,&value->low);
+ VTD_Get_Real_Time(&value->high,&value->low);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/aawin32.c b/board/MAI/bios_emulator/scitech/src/common/aawin32.c
index f63f004f99..541df4ac58 100644
--- a/board/MAI/bios_emulator/scitech/src/common/aawin32.c
+++ b/board/MAI/bios_emulator/scitech/src/common/aawin32.c
@@ -75,9 +75,9 @@ GA_sharedInfo * NAPI GA_getSharedInfo(
PM_init();
inBuf[0] = device;
if (DeviceIoControl(_PM_hDevice, PMHELP_GETSHAREDINFO32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL)) {
- return (GA_sharedInfo*)outBuf[0];
- }
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return (GA_sharedInfo*)outBuf[0];
+ }
return NULL;
}
@@ -102,16 +102,16 @@ static ibool NAPI _GA_softStereoInit(
GA_devCtx *dc)
{
if (_PM_hDevice) {
- DWORD inBuf[1]; /* Buffer to send data to VxD */
- DWORD outBuf[1]; /* Buffer to receive data from VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD inBuf[1]; /* Buffer to send data to VxD */
+ DWORD outBuf[1]; /* Buffer to receive data from VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- inBuf[0] = (ulong)dc;
- if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOINIT32, inBuf, sizeof(inBuf),
- outBuf, sizeof(outBuf), &count, NULL)) {
- return outBuf[0];
- }
- }
+ inBuf[0] = (ulong)dc;
+ if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOINIT32, inBuf, sizeof(inBuf),
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return outBuf[0];
+ }
+ }
return false;
}
@@ -122,9 +122,9 @@ This function turns on software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoOn(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOON32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOON32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -137,14 +137,14 @@ static void NAPI _GA_softStereoScheduleFlip(
N_uint32 rightAddr)
{
if (_PM_hDevice) {
- DWORD inBuf[2]; /* Buffer to send data to VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD inBuf[2]; /* Buffer to send data to VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- inBuf[0] = (ulong)leftAddr;
- inBuf[1] = (ulong)rightAddr;
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIP32, inBuf, sizeof(inBuf),
- NULL, 0, &count, NULL);
- }
+ inBuf[0] = (ulong)leftAddr;
+ inBuf[1] = (ulong)rightAddr;
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIP32, inBuf, sizeof(inBuf),
+ NULL, 0, &count, NULL);
+ }
}
/****************************************************************************
@@ -154,14 +154,14 @@ This function turns off software stereo mode, either directly or via the VxD.
static N_int32 NAPI _GA_softStereoGetFlipStatus(void)
{
if (_PM_hDevice) {
- DWORD outBuf[1]; /* Buffer to receive data from VxD */
- DWORD count; /* Count of bytes returned from VxD */
+ DWORD outBuf[1]; /* Buffer to receive data from VxD */
+ DWORD count; /* Count of bytes returned from VxD */
- if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIPSTATUS32, NULL, 0,
- outBuf, sizeof(outBuf), &count, NULL)) {
- return outBuf[0];
- }
- }
+ if (DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOFLIPSTATUS32, NULL, 0,
+ outBuf, sizeof(outBuf), &count, NULL)) {
+ return outBuf[0];
+ }
+ }
return 0;
}
@@ -172,7 +172,7 @@ This function turns off software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoWaitTillFlipped(void)
{
while (!_GA_softStereoGetFlipStatus())
- ;
+ ;
}
/****************************************************************************
@@ -182,9 +182,9 @@ This function turns off software stereo mode, either directly or via the VxD.
static void NAPI _GA_softStereoOff(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOOFF32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOOFF32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -195,9 +195,9 @@ the VxD.
static void NAPI _GA_softStereoExit(void)
{
if (_PM_hDevice) {
- DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOEXIT32, NULL, 0,
- NULL, 0, NULL, NULL);
- }
+ DeviceIoControl(_PM_hDevice, PMHELP_GASTEREOEXIT32, NULL, 0,
+ NULL, 0, NULL, NULL);
+ }
}
/****************************************************************************
@@ -217,14 +217,14 @@ static GA_devCtx * NAPI _GA_loadDriver(
N_int32 totalMemory = 0,oldIOPL;
if (deviceIndex >= GA_MAX_DEVICES)
- PM_fatalError("DeviceIndex too large in GA_loadDriver!");
+ PM_fatalError("DeviceIndex too large in GA_loadDriver!");
PM_init();
inBuf[0] = deviceIndex;
if (DeviceIoControl(_PM_hDevice, PMHELP_GETMEMSIZE32,
- inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), NULL, NULL))
- totalMemory = outBuf[0];
+ inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), NULL, NULL))
+ totalMemory = outBuf[0];
if (totalMemory == 0)
- totalMemory = 8192;
+ totalMemory = 8192;
_GA_exports.GA_forceMemSize(totalMemory,shared);
oldIOPL = PM_setIOPL(3);
dc = ORG_GA_loadDriver(deviceIndex,shared);
@@ -240,13 +240,13 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
else if (QueryPerformanceFrequency((LARGE_INTEGER*)&countFreq)) {
- haveRDTSC = false;
- return true;
- }
+ haveRDTSC = false;
+ return true;
+ }
return false;
}
@@ -258,7 +258,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- QueryPerformanceCounter((LARGE_INTEGER*)value);
+ QueryPerformanceCounter((LARGE_INTEGER*)value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/agplib.c b/board/MAI/bios_emulator/scitech/src/common/agplib.c
index df8f932fb1..476eedc873 100644
--- a/board/MAI/bios_emulator/scitech/src/common/agplib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/agplib.c
@@ -88,31 +88,31 @@ static ibool LoadDriver(void)
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,false)) == NULL)
- return false;
+ return false;
if ((AGP_initLibrary = (AGP_initLibrary_t)PE_getProcAddress(hModBPD,"_AGP_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((agpExp = AGP_initLibrary(bpdpath,filename,GA_getSystemPMImports(),&_N_imports,&_AGP_imports)) == NULL)
- PM_fatalError("AGP_initLibrary failed!\n");
+ PM_fatalError("AGP_initLibrary failed!\n");
_AGP_exports.dwSize = sizeof(_AGP_exports);
max = sizeof(_AGP_exports)/sizeof(AGP_initLibrary_t);
for (i = 0,p = (ulong*)&_AGP_exports; i < max; i++)
- *p++ = (ulong)_AGP_fatalErrorHandler;
+ *p++ = (ulong)_AGP_fatalErrorHandler;
memcpy(&_AGP_exports,agpExp,MIN(sizeof(_AGP_exports),agpExp->dwSize));
loaded = true;
return true;
@@ -127,7 +127,7 @@ static ibool LoadDriver(void)
int NAPI AGP_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return _AGP_exports.AGP_status();
}
@@ -136,7 +136,7 @@ const char * NAPI AGP_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return _AGP_exports.AGP_errorMsg(status);
}
@@ -144,7 +144,7 @@ const char * NAPI AGP_errorMsg(
AGP_devCtx * NAPI AGP_loadDriver(N_int32 deviceIndex)
{
if (!LoadDriver())
- return NULL;
+ return NULL;
return _AGP_exports.AGP_loadDriver(deviceIndex);
}
@@ -153,7 +153,7 @@ void NAPI AGP_unloadDriver(
AGP_devCtx *dc)
{
if (loaded)
- _AGP_exports.AGP_unloadDriver(dc);
+ _AGP_exports.AGP_unloadDriver(dc);
}
/* {secret} */
@@ -161,7 +161,7 @@ void NAPI AGP_getGlobalOptions(
AGP_globalOptions *options)
{
if (LoadDriver())
- _AGP_exports.AGP_getGlobalOptions(options);
+ _AGP_exports.AGP_getGlobalOptions(options);
}
/* {secret} */
@@ -169,7 +169,7 @@ void NAPI AGP_setGlobalOptions(
AGP_globalOptions *options)
{
if (LoadDriver())
- _AGP_exports.AGP_setGlobalOptions(options);
+ _AGP_exports.AGP_setGlobalOptions(options);
}
/* {secret} */
@@ -177,7 +177,7 @@ void NAPI AGP_saveGlobalOptions(
AGP_globalOptions *options)
{
if (loaded)
- _AGP_exports.AGP_saveGlobalOptions(options);
+ _AGP_exports.AGP_saveGlobalOptions(options);
}
#endif
@@ -197,24 +197,23 @@ void NAPI _OS_delay(
if (!inited) {
#ifndef __WIN32_VXD__
- // This has been causing problems in VxD's for some reason, so for now
- // we avoid using it.
- if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- ZTimerInit();
- haveRDTSC = true;
- }
- else
+ /* This has been causing problems in VxD's for some reason, so for now */
+ /* we avoid using it. */
+ if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
+ ZTimerInit();
+ haveRDTSC = true;
+ }
+ else
#endif
- haveRDTSC = false;
- inited = true;
- }
+ haveRDTSC = false;
+ inited = true;
+ }
if (haveRDTSC) {
- LZTimerOnExt(&tm);
- while (LZTimerLapExt(&tm) < microSeconds)
- ;
- LZTimerOnExt(&tm);
- }
+ LZTimerOnExt(&tm);
+ while (LZTimerLapExt(&tm) < microSeconds)
+ ;
+ LZTimerOnExt(&tm);
+ }
else
- _OS_delay8253(microSeconds);
+ _OS_delay8253(microSeconds);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/center.c b/board/MAI/bios_emulator/scitech/src/common/center.c
index 7eb368fd3a..68e17c2a94 100644
--- a/board/MAI/bios_emulator/scitech/src/common/center.c
+++ b/board/MAI/bios_emulator/scitech/src/common/center.c
@@ -60,19 +60,19 @@ void _EXPORT CenterWindow(HWND hWndCenter, HWND parent, BOOL repaint)
CenterY = ((RectParent.bottom - RectParent.top) - Height) / 2;
if ((CenterX < 0) || (CenterY < 0)) {
- /* The Center Window is smaller than the parent window. */
- if (hWndParent != GetDesktopWindow()) {
- /* If the parent window is not the desktop use the desktop size. */
- CenterX = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
- CenterY = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
- }
- CenterX = (CenterX < 0) ? 0: CenterX;
- CenterY = (CenterY < 0) ? 0: CenterY;
- }
+ /* The Center Window is smaller than the parent window. */
+ if (hWndParent != GetDesktopWindow()) {
+ /* If the parent window is not the desktop use the desktop size. */
+ CenterX = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2;
+ CenterY = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2;
+ }
+ CenterX = (CenterX < 0) ? 0: CenterX;
+ CenterY = (CenterY < 0) ? 0: CenterY;
+ }
else {
- CenterX += RectParent.left;
- CenterY += RectParent.top;
- }
+ CenterX += RectParent.left;
+ CenterY += RectParent.top;
+ }
/* Copy the values into RectCenter */
RectCenter.left = CenterX;
@@ -82,8 +82,8 @@ void _EXPORT CenterWindow(HWND hWndCenter, HWND parent, BOOL repaint)
/* Move the window to the new location */
MoveWindow(hWndCenter, RectCenter.left, RectCenter.top,
- (RectCenter.right - RectCenter.left),
- (RectCenter.bottom - RectCenter.top), repaint);
+ (RectCenter.right - RectCenter.left),
+ (RectCenter.bottom - RectCenter.top), repaint);
}
void _EXPORT CenterLogo(HWND hWndLogo, HWND hWndParent, int CenterY)
@@ -117,7 +117,6 @@ void _EXPORT CenterLogo(HWND hWndLogo, HWND hWndParent, int CenterY)
/* Move the window to the new location */
MoveWindow(hWndLogo, RectCenter.left, RectCenter.top,
- (RectCenter.right - RectCenter.left),
- (RectCenter.bottom - RectCenter.top), false);
+ (RectCenter.right - RectCenter.left),
+ (RectCenter.bottom - RectCenter.top), false);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/cmdline.c b/board/MAI/bios_emulator/scitech/src/common/cmdline.c
index 872fae9194..531e5e1312 100644
--- a/board/MAI/bios_emulator/scitech/src/common/cmdline.c
+++ b/board/MAI/bios_emulator/scitech/src/common/cmdline.c
@@ -106,49 +106,49 @@ int getcmdopt(
char *formatchar;
if (argc > nextargv) {
- if (nextchar == NULL) {
- nextchar = argv[nextargv]; /* Index next argument */
- if (nextchar == NULL) {
- nextargv++;
- return ALLDONE; /* No more options */
- }
- if (IS_NOT_SWITCH_CHAR(*nextchar)) {
- nextchar = NULL;
- return PARAMETER; /* We have a parameter */
- }
- nextchar++; /* Move past switch operator */
- if (IS_SWITCH_CHAR(*nextchar)) {
- nextchar = NULL;
- return INVALID; /* Ignore rest of line */
- }
- }
- if ((ch = *(nextchar++)) == 0) {
- nextchar = NULL;
- return INVALID; /* No options on line */
- }
-
- if (ch == ':' || (formatchar = strchr(format, ch)) == NULL)
- return INVALID;
-
- if (*(++formatchar) == ':') { /* Expect an argument after option */
- nextargv++;
- if (*nextchar == 0) {
- if (argc <= nextargv)
- return INVALID;
- nextchar = argv[nextargv++];
- }
- *argument = nextchar;
- nextchar = NULL;
- }
- else { /* We have a switch style option */
- if (*nextchar == 0) {
- nextargv++;
- nextchar = NULL;
- }
- *argument = NULL;
- }
- return ch; /* return the option specifier */
- }
+ if (nextchar == NULL) {
+ nextchar = argv[nextargv]; /* Index next argument */
+ if (nextchar == NULL) {
+ nextargv++;
+ return ALLDONE; /* No more options */
+ }
+ if (IS_NOT_SWITCH_CHAR(*nextchar)) {
+ nextchar = NULL;
+ return PARAMETER; /* We have a parameter */
+ }
+ nextchar++; /* Move past switch operator */
+ if (IS_SWITCH_CHAR(*nextchar)) {
+ nextchar = NULL;
+ return INVALID; /* Ignore rest of line */
+ }
+ }
+ if ((ch = *(nextchar++)) == 0) {
+ nextchar = NULL;
+ return INVALID; /* No options on line */
+ }
+
+ if (ch == ':' || (formatchar = strchr(format, ch)) == NULL)
+ return INVALID;
+
+ if (*(++formatchar) == ':') { /* Expect an argument after option */
+ nextargv++;
+ if (*nextchar == 0) {
+ if (argc <= nextargv)
+ return INVALID;
+ nextchar = argv[nextargv++];
+ }
+ *argument = nextchar;
+ nextchar = NULL;
+ }
+ else { /* We have a switch style option */
+ if (*nextchar == 0) {
+ nextargv++;
+ nextchar = NULL;
+ }
+ *argument = NULL;
+ }
+ return ch; /* return the option specifier */
+ }
nextchar = NULL;
nextargv++;
return ALLDONE; /* no arguments on command line */
@@ -174,51 +174,51 @@ static int parse_option(
int num_read;
switch ((int)(optarr->type)) {
- case OPT_INTEGER:
- num_read = sscanf(argument,"%d",(int*)optarr->arg);
- break;
- case OPT_HEX:
- num_read = sscanf(argument,"%x",(int*)optarr->arg);
- break;
- case OPT_OCTAL:
- num_read = sscanf(argument,"%o",(int*)optarr->arg);
- break;
- case OPT_UNSIGNED:
- num_read = sscanf(argument,"%u",(uint*)optarr->arg);
- break;
- case OPT_LINTEGER:
- num_read = sscanf(argument,"%ld",(long*)optarr->arg);
- break;
- case OPT_LHEX:
- num_read = sscanf(argument,"%lx",(long*)optarr->arg);
- break;
- case OPT_LOCTAL:
- num_read = sscanf(argument,"%lo",(long*)optarr->arg);
- break;
- case OPT_LUNSIGNED:
- num_read = sscanf(argument,"%lu",(ulong*)optarr->arg);
- break;
- case OPT_FLOAT:
- num_read = sscanf(argument,"%f",(float*)optarr->arg);
- break;
- case OPT_DOUBLE:
- num_read = sscanf(argument,"%lf",(double*)optarr->arg);
- break;
- case OPT_LDOUBLE:
- num_read = sscanf(argument,"%Lf",(long double*)optarr->arg);
- break;
- case OPT_STRING:
- num_read = 1; /* This always works */
- *((char**)optarr->arg) = argument;
- break;
- default:
- return INVALID;
- }
+ case OPT_INTEGER:
+ num_read = sscanf(argument,"%d",(int*)optarr->arg);
+ break;
+ case OPT_HEX:
+ num_read = sscanf(argument,"%x",(int*)optarr->arg);
+ break;
+ case OPT_OCTAL:
+ num_read = sscanf(argument,"%o",(int*)optarr->arg);
+ break;
+ case OPT_UNSIGNED:
+ num_read = sscanf(argument,"%u",(uint*)optarr->arg);
+ break;
+ case OPT_LINTEGER:
+ num_read = sscanf(argument,"%ld",(long*)optarr->arg);
+ break;
+ case OPT_LHEX:
+ num_read = sscanf(argument,"%lx",(long*)optarr->arg);
+ break;
+ case OPT_LOCTAL:
+ num_read = sscanf(argument,"%lo",(long*)optarr->arg);
+ break;
+ case OPT_LUNSIGNED:
+ num_read = sscanf(argument,"%lu",(ulong*)optarr->arg);
+ break;
+ case OPT_FLOAT:
+ num_read = sscanf(argument,"%f",(float*)optarr->arg);
+ break;
+ case OPT_DOUBLE:
+ num_read = sscanf(argument,"%lf",(double*)optarr->arg);
+ break;
+ case OPT_LDOUBLE:
+ num_read = sscanf(argument,"%Lf",(long double*)optarr->arg);
+ break;
+ case OPT_STRING:
+ num_read = 1; /* This always works */
+ *((char**)optarr->arg) = argument;
+ break;
+ default:
+ return INVALID;
+ }
if (num_read == 0)
- return INVALID;
+ return INVALID;
else
- return ALLDONE;
+ return ALLDONE;
}
/****************************************************************************
@@ -261,8 +261,8 @@ int getargs(
int num_opt,
Option optarr[],
int (*do_param)(
- char *param,
- int num))
+ char *param,
+ int num))
{
int i,opt;
char *argument;
@@ -273,51 +273,51 @@ int getargs(
strcpy(cmdstr,"hH?");
for (i = 0,opt = 3; i < num_opt; i++,opt++) {
- cmdstr[opt] = optarr[i].opt;
- if (optarr[i].type != OPT_SWITCH) {
- cmdstr[++opt] = ':';
- }
- }
+ cmdstr[opt] = optarr[i].opt;
+ if (optarr[i].type != OPT_SWITCH) {
+ cmdstr[++opt] = ':';
+ }
+ }
cmdstr[opt] = '\0';
for (;;) {
- opt = getcmdopt(argc,argv,cmdstr,&argument);
- switch (opt) {
- case 'H':
- case 'h':
- case '?':
- return HELP;
- case ALLDONE:
- return ALLDONE;
- case INVALID:
- return INVALID;
- case PARAMETER:
- if (do_param == NULL)
- return INVALID;
- if (do_param(argv[nextargv],param_num) == INVALID)
- return INVALID;
- nextargv++;
- param_num++;
- break;
- default:
-
- /* Search for the option in the option array. We are
- * guaranteed to find it.
- */
-
- for (i = 0; i < num_opt; i++) {
- if (optarr[i].opt == opt)
- break;
- }
- if (optarr[i].type == OPT_SWITCH)
- *((ibool*)optarr[i].arg) = true;
- else {
- if (parse_option(&optarr[i],argument) == INVALID)
- return INVALID;
- }
- break;
- }
- }
+ opt = getcmdopt(argc,argv,cmdstr,&argument);
+ switch (opt) {
+ case 'H':
+ case 'h':
+ case '?':
+ return HELP;
+ case ALLDONE:
+ return ALLDONE;
+ case INVALID:
+ return INVALID;
+ case PARAMETER:
+ if (do_param == NULL)
+ return INVALID;
+ if (do_param(argv[nextargv],param_num) == INVALID)
+ return INVALID;
+ nextargv++;
+ param_num++;
+ break;
+ default:
+
+ /* Search for the option in the option array. We are
+ * guaranteed to find it.
+ */
+
+ for (i = 0; i < num_opt; i++) {
+ if (optarr[i].opt == opt)
+ break;
+ }
+ if (optarr[i].type == OPT_SWITCH)
+ *((ibool*)optarr[i].arg) = true;
+ else {
+ if (parse_option(&optarr[i],argument) == INVALID)
+ return INVALID;
+ }
+ break;
+ }
+ }
}
/****************************************************************************
@@ -340,11 +340,11 @@ void print_desc(
int i;
for (i = 0; i < num_opt; i++) {
- if (optarr[i].type == OPT_SWITCH)
- printf(" -%c %s\n",optarr[i].opt,optarr[i].desc);
- else
- printf(" -%c<arg> %s\n",optarr[i].opt,optarr[i].desc);
- }
+ if (optarr[i].type == OPT_SWITCH)
+ printf(" -%c %s\n",optarr[i].opt,optarr[i].desc);
+ else
+ printf(" -%c<arg> %s\n",optarr[i].opt,optarr[i].desc);
+ }
}
/****************************************************************************
@@ -382,45 +382,45 @@ int parse_commandline(
argv[argc++] = filename;
cmdLine = strncpy(str, cmdLine, sizeof(str)-1);
while (*cmdLine) {
- switch (*cmdLine) {
- case '"' :
- if (prevWord != NULL) {
- if (inQuote) {
- if (!noStrip)
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- prevWord = NULL;
- }
- else
- noStrip = TRUE;
- }
- inQuote = !inQuote;
- break;
- case ' ' :
- case '\t' :
- if (!inQuote) {
- if (prevWord != NULL) {
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- prevWord = NULL;
- noStrip = FALSE;
- }
- }
- break;
- default :
- if (prevWord == NULL)
- prevWord = cmdLine;
- break;
- }
- if (argc >= maxArgv - 1)
- break;
- cmdLine++;
- }
+ switch (*cmdLine) {
+ case '"' :
+ if (prevWord != NULL) {
+ if (inQuote) {
+ if (!noStrip)
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ prevWord = NULL;
+ }
+ else
+ noStrip = TRUE;
+ }
+ inQuote = !inQuote;
+ break;
+ case ' ' :
+ case '\t' :
+ if (!inQuote) {
+ if (prevWord != NULL) {
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ prevWord = NULL;
+ noStrip = FALSE;
+ }
+ }
+ break;
+ default :
+ if (prevWord == NULL)
+ prevWord = cmdLine;
+ break;
+ }
+ if (argc >= maxArgv - 1)
+ break;
+ cmdLine++;
+ }
if ((prevWord != NULL || (inQuote && prevWord != NULL)) && argc < maxArgv - 1) {
- *cmdLine = '\0';
- argv [argc++] = prevWord;
- }
+ *cmdLine = '\0';
+ argv [argc++] = prevWord;
+ }
argv[argc] = NULL;
/* Return updated parameters */
diff --git a/board/MAI/bios_emulator/scitech/src/common/gabeos.c b/board/MAI/bios_emulator/scitech/src/common/gabeos.c
index 1d8a543216..a934bd1cfc 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gabeos.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gabeos.c
@@ -70,10 +70,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for BeOS here. That will eliminate fatal errors loading new
- // drivers on BeOS!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for BeOS here. That will eliminate fatal errors loading new */
+ /* drivers on BeOS! */
return &_PM_imports;
}
@@ -124,7 +124,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -136,11 +136,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gados.c b/board/MAI/bios_emulator/scitech/src/common/gados.c
index 4c90e805d7..d2be77694f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gados.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gados.c
@@ -120,7 +120,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
@@ -133,4 +133,3 @@ void NAPI GA_TimerRead(
{
_GA_readTimeStamp(value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/galib.c b/board/MAI/bios_emulator/scitech/src/common/galib.c
index 7c1fbe312d..f2eacc3d24 100644
--- a/board/MAI/bios_emulator/scitech/src/common/galib.c
+++ b/board/MAI/bios_emulator/scitech/src/common/galib.c
@@ -107,7 +107,7 @@ static ibool LoadDriver(
/* Check if we have already loaded the driver */
if (loaded)
- return true;
+ return true;
PM_init();
/* First try to see if we can find the system wide shared exports
@@ -116,33 +116,33 @@ static ibool LoadDriver(
*/
__GA_exports.dwSize = sizeof(__GA_exports);
if (GA_getSharedExports(&__GA_exports,shared))
- return loaded = true;
+ return loaded = true;
/* Open the BPD file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModBPD = PE_loadLibrary(filename,shared)) == NULL)
- return false;
+ return false;
if ((GA_initLibrary = (GA_initLibrary_t)PE_getProcAddress(hModBPD,"_GA_initLibrary")) == NULL)
- return false;
+ return false;
bpdpath[strlen(bpdpath)-1] = 0;
if (strcmp(bpdpath,PM_getNucleusPath()) == 0)
- strcpy(bpdpath,PM_getNucleusConfigPath());
+ strcpy(bpdpath,PM_getNucleusConfigPath());
else {
- PM_backslash(bpdpath);
- strcat(bpdpath,"config");
- }
+ PM_backslash(bpdpath);
+ strcat(bpdpath,"config");
+ }
if ((gaExp = GA_initLibrary(shared,bpdpath,filename,GA_getSystemPMImports(),&_N_imports,&_GA_imports)) == NULL)
- PM_fatalError("GA_initLibrary failed!\n");
+ PM_fatalError("GA_initLibrary failed!\n");
/* Initialize all default imports to point to fatal error handler
* for upwards compatibility, and copy the exported functions.
*/
max = sizeof(__GA_exports)/sizeof(GA_initLibrary_t);
for (i = 0,p = (ulong*)&__GA_exports; i < max; i++)
- *p++ = (ulong)_GA_fatalErrorHandler;
+ *p++ = (ulong)_GA_fatalErrorHandler;
memcpy(&__GA_exports,gaExp,MIN(sizeof(__GA_exports),gaExp->dwSize));
loaded = true;
return true;
@@ -157,7 +157,7 @@ static ibool LoadDriver(
int NAPI GA_status(void)
{
if (!loaded)
- return nDriverNotFound;
+ return nDriverNotFound;
return __GA_exports.GA_status();
}
@@ -166,7 +166,7 @@ const char * NAPI GA_errorMsg(
N_int32 status)
{
if (!loaded)
- return "Unable to load Nucleus device driver!";
+ return "Unable to load Nucleus device driver!";
return __GA_exports.GA_errorMsg(status);
}
@@ -174,7 +174,7 @@ const char * NAPI GA_errorMsg(
int NAPI GA_getDaysLeft(N_int32 shared)
{
if (!LoadDriver(shared))
- return -1;
+ return -1;
return __GA_exports.GA_getDaysLeft(shared);
}
@@ -182,7 +182,7 @@ int NAPI GA_getDaysLeft(N_int32 shared)
int NAPI GA_registerLicense(uchar *license,N_int32 shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_registerLicense(license,shared);
}
@@ -190,7 +190,7 @@ int NAPI GA_registerLicense(uchar *license,N_int32 shared)
ibool NAPI GA_loadInGUI(N_int32 shared)
{
if (!LoadDriver(shared))
- return false;
+ return false;
return __GA_exports.GA_loadInGUI(shared);
}
@@ -198,7 +198,7 @@ ibool NAPI GA_loadInGUI(N_int32 shared)
int NAPI GA_enumerateDevices(N_int32 shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_enumerateDevices(shared);
}
@@ -206,7 +206,7 @@ int NAPI GA_enumerateDevices(N_int32 shared)
GA_devCtx * NAPI GA_loadDriver(N_int32 deviceIndex,N_int32 shared)
{
if (!LoadDriver(shared))
- return NULL;
+ return NULL;
return __GA_exports.GA_loadDriver(deviceIndex,shared);
}
@@ -216,7 +216,7 @@ void NAPI GA_getGlobalOptions(
ibool shared)
{
if (LoadDriver(shared))
- __GA_exports.GA_getGlobalOptions(options,shared);
+ __GA_exports.GA_getGlobalOptions(options,shared);
}
/* {secret} */
@@ -226,7 +226,7 @@ PE_MODULE * NAPI GA_loadLibrary(
ibool shared)
{
if (!LoadDriver(shared))
- return NULL;
+ return NULL;
return __GA_exports.GA_loadLibrary(szBPDName,size,shared);
}
@@ -236,7 +236,7 @@ GA_devCtx * NAPI GA_getCurrentDriver(
{
/* Bail for older drivers that didn't export this function! */
if (!__GA_exports.GA_getCurrentDriver)
- return NULL;
+ return NULL;
return __GA_exports.GA_getCurrentDriver(deviceIndex);
}
@@ -246,7 +246,7 @@ REF2D_driver * NAPI GA_getCurrentRef2d(
{
/* Bail for older drivers that didn't export this function! */
if (!__GA_exports.GA_getCurrentRef2d)
- return NULL;
+ return NULL;
return __GA_exports.GA_getCurrentRef2d(deviceIndex);
}
@@ -254,7 +254,7 @@ REF2D_driver * NAPI GA_getCurrentRef2d(
int NAPI GA_isOEMVersion(ibool shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_isOEMVersion(shared);
}
@@ -262,8 +262,7 @@ int NAPI GA_isOEMVersion(ibool shared)
N_uint32 * NAPI GA_getLicensedDevices(ibool shared)
{
if (!LoadDriver(shared))
- return 0;
+ return 0;
return __GA_exports.GA_getLicensedDevices(shared);
}
#endif
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/galinux.c b/board/MAI/bios_emulator/scitech/src/common/galinux.c
index cbd9d7f4e5..47e4e8581d 100644
--- a/board/MAI/bios_emulator/scitech/src/common/galinux.c
+++ b/board/MAI/bios_emulator/scitech/src/common/galinux.c
@@ -72,10 +72,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for Linux here. That will eliminate fatal errors loading new
- // drivers on Linux!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for Linux here. That will eliminate fatal errors loading new */
+ /* drivers on Linux! */
return &_PM_imports;
}
@@ -126,7 +126,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -138,11 +138,11 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timeval t;
- gettimeofday(&t, NULL);
- value->low = t.tv_sec*1000000 + t.tv_usec;
- value->high = 0;
- }
+ struct timeval t;
+ gettimeofday(&t, NULL);
+ value->low = t.tv_sec*1000000 + t.tv_usec;
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gantdrv.c b/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
index d9944c56ae..050f73767c 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gantdrv.c
@@ -117,8 +117,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -130,8 +130,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- KeQuerySystemTime((LARGE_INTEGER*)value);
+ KeQuerySystemTime((LARGE_INTEGER*)value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gaos2.c b/board/MAI/bios_emulator/scitech/src/common/gaos2.c
index 822e93ca61..26e6503e5f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gaos2.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gaos2.c
@@ -83,11 +83,11 @@ static ulong CallSDDHelp(
* can't fail here.
*/
DosOpen(PMHELP_NAME,&hSDDHelp,&result[0],0,0,
- FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
- NULL);
+ FILE_OPEN, OPEN_SHARE_DENYNONE | OPEN_ACCESS_READWRITE,
+ NULL);
DosDevIOCtl(hSDDHelp,PMHELP_IOCTL,func,
- &parms, inLen = sizeof(parms), &inLen,
- &result, outLen = sizeof(result), &outLen);
+ &parms, inLen = sizeof(parms), &inLen,
+ &result, outLen = sizeof(result), &outLen);
DosClose(hSDDHelp);
return result[0];
}
@@ -147,17 +147,17 @@ ibool NAPI GA_getSharedExports(
/* Initialise the PM library and connect to our runtime DLL's */
PM_init();
if (CallSDDHelp(PMHELP_GETSHAREDEXP) != 0) {
- /* We have found the shared Nucleus exports. Because not all processes
- * map to SDDPMI.DLL, we need to ensure that we connect to this
- * DLL so that it gets mapped into our address space (that is
- * where the shared Nucleus loader code is located). Simply doing a
- * DosLoadModule on it is enough for this.
- */
- DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
- exp = (GA_exports*)result[0];
- memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
- return true;
- }
+ /* We have found the shared Nucleus exports. Because not all processes
+ * map to SDDPMI.DLL, we need to ensure that we connect to this
+ * DLL so that it gets mapped into our address space (that is
+ * where the shared Nucleus loader code is located). Simply doing a
+ * DosLoadModule on it is enough for this.
+ */
+ DosLoadModule((PSZ)buf,sizeof(buf),(PSZ)"SDDPMI.DLL",&hModSDDPMI);
+ exp = (GA_exports*)result[0];
+ memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
+ return true;
+ }
#endif
(void)shared;
return false;
@@ -197,7 +197,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -209,9 +209,9 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- DosTmrQueryTime((QWORD*)value);
+ DosTmrQueryTime((QWORD*)value);
}
/****************************************************************************
diff --git a/board/MAI/bios_emulator/scitech/src/common/gaqnx.c b/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
index 0846cccef0..525d662869 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gaqnx.c
@@ -72,10 +72,10 @@ library is used with the application local version of Nucleus.
****************************************************************************/
PM_imports * NAPI GA_getSystemPMImports(void)
{
- // TODO: We may very well want to provide a system shared library
- // that eports the PM functions required by the Nucleus library
- // for QNX here. That will eliminate fatal errors loading new
- // drivers on QNX!
+ /* TODO: We may very well want to provide a system shared library */
+ /* that eports the PM functions required by the Nucleus library */
+ /* for QNX here. That will eliminate fatal errors loading new */
+ /* drivers on QNX! */
return &_PM_imports;
}
@@ -126,7 +126,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- haveRDTSC = true;
+ haveRDTSC = true;
return true;
}
@@ -138,12 +138,12 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else {
- struct timespec ts;
+ struct timespec ts;
- clock_gettime(CLOCK_REALTIME, &ts);
- value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
- value->high = 0;
- }
+ clock_gettime(CLOCK_REALTIME, &ts);
+ value->low = (ts.tv_nsec / 1000 + ts.tv_sec * 1000000);
+ value->high = 0;
+ }
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gartt.c b/board/MAI/bios_emulator/scitech/src/common/gartt.c
index 003e1e7dbe..3a41f59c18 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gartt.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gartt.c
@@ -121,9 +121,9 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
return false;
}
@@ -135,5 +135,5 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gasmx.c b/board/MAI/bios_emulator/scitech/src/common/gasmx.c
index 62e68dc13e..ae31941f49 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gasmx.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gasmx.c
@@ -118,7 +118,7 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0)
- return true;
+ return true;
return false;
}
diff --git a/board/MAI/bios_emulator/scitech/src/common/gavxd.c b/board/MAI/bios_emulator/scitech/src/common/gavxd.c
index 62173cc8d0..fc8ba8d657 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gavxd.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gavxd.c
@@ -117,8 +117,8 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- }
+ haveRDTSC = true;
+ }
return true;
}
@@ -130,8 +130,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- VTD_Get_Real_Time(&value->high,&value->low);
+ VTD_Get_Real_Time(&value->high,&value->low);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gawin32.c b/board/MAI/bios_emulator/scitech/src/common/gawin32.c
index a2a4150953..69443344f4 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gawin32.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gawin32.c
@@ -67,16 +67,16 @@ static ibool LoadSharedDLL(void)
/* Check if we have already loaded the DLL */
if (hModDLL)
- return true;
+ return true;
PM_init();
/* Open the DLL file */
if (!PM_findBPD(DLL_NAME,bpdpath))
- return false;
+ return false;
strcpy(filename,bpdpath);
strcat(filename,DLL_NAME);
if ((hModDLL = LoadLibrary(filename)) == NULL)
- return false;
+ return false;
return true;
}
@@ -103,10 +103,10 @@ void NAPI GA_setLocalPath(
PM_setLocalBPDPath(path);
if (_PM_hDevice != INVALID_HANDLE_VALUE) {
- inBuf[0] = (DWORD)path;
- DeviceIoControl(_PM_hDevice, PMHELP_GASETLOCALPATH32,
- inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &outCnt, NULL);
- }
+ inBuf[0] = (DWORD)path;
+ DeviceIoControl(_PM_hDevice, PMHELP_GASETLOCALPATH32,
+ inBuf, sizeof(inBuf), outBuf, sizeof(outBuf), &outCnt, NULL);
+ }
}
/****************************************************************************
@@ -126,18 +126,18 @@ PM_imports * NAPI GA_getSystemPMImports(void)
PM_imports * (NAPIP _GA_getSystemPMImports)(void);
if (LoadSharedDLL()) {
- /* Note that Visual C++ build DLL's with only a single underscore in front
- * of the exported name while Watcom C provides two of them. We check for
- * both to allow working with either compiled DLL.
- */
- if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"_GA_getSystemPMImports")) != NULL) {
- if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"__GA_getSystemPMImports")) != NULL) {
- pmImp = _GA_getSystemPMImports();
- memcpy(&_PM_imports,pmImp,MIN(_PM_imports.dwSize,pmImp->dwSize));
- return pmImp;
- }
- }
- }
+ /* Note that Visual C++ build DLL's with only a single underscore in front
+ * of the exported name while Watcom C provides two of them. We check for
+ * both to allow working with either compiled DLL.
+ */
+ if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"_GA_getSystemPMImports")) != NULL) {
+ if ((_GA_getSystemPMImports = (void*)GetProcAddress(hModDLL,"__GA_getSystemPMImports")) != NULL) {
+ pmImp = _GA_getSystemPMImports();
+ memcpy(&_PM_imports,pmImp,MIN(_PM_imports.dwSize,pmImp->dwSize));
+ return pmImp;
+ }
+ }
+ }
return &_PM_imports;
}
@@ -162,16 +162,16 @@ ibool NAPI GA_getSharedExports(
useRing0Driver = false;
if (shared) {
- if (!LoadSharedDLL())
- PM_fatalError("Unable to load " DLL_NAME "!");
- if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"_GA_getSystemGAExports")) == NULL)
- if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"__GA_getSystemGAExports")) == NULL)
- PM_fatalError("Unable to load " DLL_NAME "!");
- exp = _GA_getSystemGAExports();
- memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
- useRing0Driver = true;
- return true;
- }
+ if (!LoadSharedDLL())
+ PM_fatalError("Unable to load " DLL_NAME "!");
+ if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"_GA_getSystemGAExports")) == NULL)
+ if ((_GA_getSystemGAExports = (void*)GetProcAddress(hModDLL,"__GA_getSystemGAExports")) == NULL)
+ PM_fatalError("Unable to load " DLL_NAME "!");
+ exp = _GA_getSystemGAExports();
+ memcpy(gaExp,exp,MIN(gaExp->dwSize,exp->dwSize));
+ useRing0Driver = true;
+ return true;
+ }
return false;
}
@@ -188,14 +188,14 @@ ibool NAPI GA_queryFunctions(
static ibool (NAPIP _GA_queryFunctions)(GA_devCtx *dc,N_uint32 id,void _FAR_ *funcs) = NULL;
if (useRing0Driver) {
- // Call the version in nga_w32.dll if it is loaded
- if (!_GA_queryFunctions) {
- if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"_GA_queryFunctions")) == NULL)
- if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"__GA_queryFunctions")) == NULL)
- PM_fatalError("Unable to get exports from " DLL_NAME "!");
- }
- return _GA_queryFunctions(dc,id,funcs);
- }
+ /* Call the version in nga_w32.dll if it is loaded */
+ if (!_GA_queryFunctions) {
+ if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"_GA_queryFunctions")) == NULL)
+ if ((_GA_queryFunctions = (void*)GetProcAddress(hModDLL,"__GA_queryFunctions")) == NULL)
+ PM_fatalError("Unable to get exports from " DLL_NAME "!");
+ }
+ return _GA_queryFunctions(dc,id,funcs);
+ }
return __GA_exports.GA_queryFunctions(dc,id,funcs);
}
@@ -211,14 +211,14 @@ ibool NAPI REF2D_queryFunctions(
static ibool (NAPIP _REF2D_queryFunctions)(REF2D_driver *ref2d,N_uint32 id,void _FAR_ *funcs) = NULL;
if (useRing0Driver) {
- // Call the version in nga_w32.dll if it is loaded
- if (!_REF2D_queryFunctions) {
- if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"_REF2D_queryFunctions")) == NULL)
- if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"__REF2D_queryFunctions")) == NULL)
- PM_fatalError("Unable to get exports from " DLL_NAME "!");
- }
- return _REF2D_queryFunctions(ref2d,id,funcs);
- }
+ /* Call the version in nga_w32.dll if it is loaded */
+ if (!_REF2D_queryFunctions) {
+ if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"_REF2D_queryFunctions")) == NULL)
+ if ((_REF2D_queryFunctions = (void*)GetProcAddress(hModDLL,"__REF2D_queryFunctions")) == NULL)
+ PM_fatalError("Unable to get exports from " DLL_NAME "!");
+ }
+ return _REF2D_queryFunctions(ref2d,id,funcs);
+ }
return __GA_exports.REF2D_queryFunctions(ref2d,id,funcs);
}
#endif
@@ -231,13 +231,13 @@ Nucleus loader library.
ibool NAPI GA_TimerInit(void)
{
if (_GA_haveCPUID() && (_GA_getCPUIDFeatures() & CPU_HaveRDTSC) != 0) {
- haveRDTSC = true;
- return true;
- }
+ haveRDTSC = true;
+ return true;
+ }
else if (QueryPerformanceFrequency((LARGE_INTEGER*)&countFreq)) {
- haveRDTSC = false;
- return true;
- }
+ haveRDTSC = false;
+ return true;
+ }
return false;
}
@@ -249,8 +249,7 @@ void NAPI GA_TimerRead(
GA_largeInteger *value)
{
if (haveRDTSC)
- _GA_readTimeStamp(value);
+ _GA_readTimeStamp(value);
else
- QueryPerformanceCounter((LARGE_INTEGER*)value);
+ QueryPerformanceCounter((LARGE_INTEGER*)value);
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c b/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
index 5a03ac5885..1d547e9abb 100644
--- a/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
+++ b/board/MAI/bios_emulator/scitech/src/common/gtfcalc.c
@@ -107,9 +107,9 @@ static void GetInternalConstants(GTF_constants *c)
c->hSync = GC.hSync;
c->minVSyncBP = GC.minVSyncBP;
if (GC.k == 0)
- c->k = 0.001;
+ c->k = 0.001;
else
- c->k = GC.k;
+ c->k = GC.k;
c->m = (c->k / 256) * GC.m;
c->c = (GC.c - GC.j) * (c->k / 256) + GC.j;
c->j = GC.j;
@@ -165,89 +165,89 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
vFieldRate = vFreq;
interlace = 0;
if (wantInterlace)
- dotClock *= 2;
+ dotClock *= 2;
/* Determine the lines for margins */
if (wantMargins) {
- topMarginLines = round(c.margin / 100 * vLines);
- botMarginLines = round(c.margin / 100 * vLines);
- }
+ topMarginLines = round(c.margin / 100 * vLines);
+ botMarginLines = round(c.margin / 100 * vLines);
+ }
else {
- topMarginLines = 0;
- botMarginLines = 0;
- }
+ topMarginLines = 0;
+ botMarginLines = 0;
+ }
if (type != GTF_lockPF) {
- if (type == GTF_lockVF) {
- /* Estimate the horizontal period */
- hPeriodEst = ((1/vFieldRate) - (c.minVSyncBP/1000000)) /
- (vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
-
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round(c.minVSyncBP / hPeriodEst);
- }
- else if (type == GTF_lockHF) {
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
- }
-
- /* Find the number of lines in the V back porch alone */
- vBackPorch = vSyncBP - c.vSyncRqd;
-
- /* Find the total number of lines in the vertical period */
- vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
- + interlace + c.minPorch;
-
- if (type == GTF_lockVF) {
- /* Estimate the vertical frequency */
- vFieldRateEst = 1000000 / (hPeriodEst * vTotalLines);
-
- /* Find the actual horizontal period */
- hPeriod = (hPeriodEst * vFieldRateEst) / vFieldRate;
-
- /* Find the actual vertical field frequency */
- vFieldRate = 1000000 / (hPeriod * vTotalLines);
- }
- else if (type == GTF_lockHF) {
- /* Find the actual vertical field frequency */
- vFieldRate = (hFreq / vTotalLines) * 1000;
- }
- }
+ if (type == GTF_lockVF) {
+ /* Estimate the horizontal period */
+ hPeriodEst = ((1/vFieldRate) - (c.minVSyncBP/1000000)) /
+ (vLines + (2*topMarginLines) + c.minPorch + interlace) * 1000000;
+
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round(c.minVSyncBP / hPeriodEst);
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+ }
+
+ /* Find the number of lines in the V back porch alone */
+ vBackPorch = vSyncBP - c.vSyncRqd;
+
+ /* Find the total number of lines in the vertical period */
+ vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
+ + interlace + c.minPorch;
+
+ if (type == GTF_lockVF) {
+ /* Estimate the vertical frequency */
+ vFieldRateEst = 1000000 / (hPeriodEst * vTotalLines);
+
+ /* Find the actual horizontal period */
+ hPeriod = (hPeriodEst * vFieldRateEst) / vFieldRate;
+
+ /* Find the actual vertical field frequency */
+ vFieldRate = 1000000 / (hPeriod * vTotalLines);
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the actual vertical field frequency */
+ vFieldRate = (hFreq / vTotalLines) * 1000;
+ }
+ }
/* Find the number of pixels in the left and right margins */
if (wantMargins) {
- leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
- rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
- }
+ leftMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
+ rightMarginPixels = round(hPixels * c.margin) / (100 * c.cellGran);
+ }
else {
- leftMarginPixels = 0;
- rightMarginPixels = 0;
- }
+ leftMarginPixels = 0;
+ rightMarginPixels = 0;
+ }
/* Find the total number of active pixels in image + margins */
hTotalActivePixels = hPixels + leftMarginPixels + rightMarginPixels;
if (type == GTF_lockVF) {
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - ((c.m * hPeriod) / 1000);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - ((c.m * hPeriod) / 1000);
+ }
else if (type == GTF_lockHF) {
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - (c.m / hFreq);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - (c.m / hFreq);
+ }
else if (type == GTF_lockPF) {
- /* Find ideal horizontal period from blanking duty cycle formula */
- idealHPeriod = (((c.c - 100) + (sqrt((pow(100-c.c,2)) +
- (0.4 * c.m * (hTotalActivePixels + rightMarginPixels +
- leftMarginPixels) / dotClock)))) / (2 * c.m)) * 1000;
+ /* Find ideal horizontal period from blanking duty cycle formula */
+ idealHPeriod = (((c.c - 100) + (sqrt((pow(100-c.c,2)) +
+ (0.4 * c.m * (hTotalActivePixels + rightMarginPixels +
+ leftMarginPixels) / dotClock)))) / (2 * c.m)) * 1000;
- /* Find the ideal blanking duty cycle */
- idealDutyCycle = c.c - ((c.m * idealHPeriod) / 1000);
- }
+ /* Find the ideal blanking duty cycle */
+ idealDutyCycle = c.c - ((c.m * idealHPeriod) / 1000);
+ }
/* Find the number of pixels in blanking time */
hBlankPixels = round((hTotalActivePixels * idealDutyCycle) /
- ((100 - idealDutyCycle) * c.cellGran)) * c.cellGran;
+ ((100 - idealDutyCycle) * c.cellGran)) * c.cellGran;
/* Find the total number of pixels */
hTotalPixels = hTotalActivePixels + hBlankPixels;
@@ -262,35 +262,35 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
hSyncBP = hBackPorch + hSyncWidth;
if (type == GTF_lockPF) {
- /* Find the horizontal frequency */
- hFreq = (dotClock / hTotalPixels) * 1000;
+ /* Find the horizontal frequency */
+ hFreq = (dotClock / hTotalPixels) * 1000;
- /* Find the number of lines in vSync + back porch */
- vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
+ /* Find the number of lines in vSync + back porch */
+ vSyncBP = round((c.minVSyncBP * hFreq) / 1000);
- /* Find the number of lines in the V back porch alone */
- vBackPorch = vSyncBP - c.vSyncRqd;
+ /* Find the number of lines in the V back porch alone */
+ vBackPorch = vSyncBP - c.vSyncRqd;
- /* Find the total number of lines in the vertical period */
- vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
- + interlace + c.minPorch;
+ /* Find the total number of lines in the vertical period */
+ vTotalLines = vLines + topMarginLines + botMarginLines + vSyncBP
+ + interlace + c.minPorch;
- /* Find the actual vertical field frequency */
- vFieldRate = (hFreq / vTotalLines) * 1000;
- }
+ /* Find the actual vertical field frequency */
+ vFieldRate = (hFreq / vTotalLines) * 1000;
+ }
else {
- if (type == GTF_lockVF) {
- /* Find the horizontal frequency */
- hFreq = 1000 / hPeriod;
- }
- else if (type == GTF_lockHF) {
- /* Find the horizontal frequency */
- hPeriod = 1000 / hFreq;
- }
-
- /* Find the pixel clock frequency */
- dotClock = hTotalPixels / hPeriod;
- }
+ if (type == GTF_lockVF) {
+ /* Find the horizontal frequency */
+ hFreq = 1000 / hPeriod;
+ }
+ else if (type == GTF_lockHF) {
+ /* Find the horizontal frequency */
+ hPeriod = 1000 / hFreq;
+ }
+
+ /* Find the pixel clock frequency */
+ dotClock = hTotalPixels / hPeriod;
+ }
/* Return the computed frequencies */
t->vFreq = vFieldRate;
@@ -315,16 +315,16 @@ void GTF_calcTimings(double hPixels,double vLines,double freq,
t->v.vSyncWidth = (int)c.vSyncRqd;
t->v.vBackPorch = (int)vBackPorch;
if (wantInterlace) {
- /* Halve the timings for interlaced modes */
- t->v.vTotal /= 2;
- t->v.vDisp /= 2;
- t->v.vSyncStart /= 2;
- t->v.vSyncEnd /= 2;
- t->v.vFrontPorch /= 2;
- t->v.vSyncWidth /= 2;
- t->v.vBackPorch /= 2;
- t->dotClock /= 2;
- }
+ /* Halve the timings for interlaced modes */
+ t->v.vTotal /= 2;
+ t->v.vDisp /= 2;
+ t->v.vSyncStart /= 2;
+ t->v.vSyncEnd /= 2;
+ t->v.vFrontPorch /= 2;
+ t->v.vSyncWidth /= 2;
+ t->v.vBackPorch /= 2;
+ t->dotClock /= 2;
+ }
/* Mark as GTF timing using the sync polarities */
t->interlace = (wantInterlace) ? 'I' : 'N';
@@ -348,30 +348,30 @@ void main(int argc,char *argv[])
GTF_timings t;
if (argc != 5 && argc != 6) {
- printf("Usage: GTFCALC <xPixels> <yPixels> <freq> [[Hz] [KHz] [MHz]] [I]\n");
- printf("\n");
- printf("where <xPixels> is the horizontal resolution of the mode, <yPixels> is the\n");
- printf("vertical resolution of the mode. The <freq> value will be the frequency to\n");
- printf("drive the calculations, and will be either the vertical frequency (in Hz)\n");
- printf("the horizontal frequency (in KHz) or the dot clock (in MHz). To generate\n");
- printf("timings for an interlaced mode, add 'I' to the end of the command line.\n");
- printf("\n");
- printf("For example to generate timings for 640x480 at 60Hz vertical:\n");
- printf("\n");
- printf(" GTFCALC 640 480 60 Hz\n");
- printf("\n");
- printf("For example to generate timings for 640x480 at 31.5KHz horizontal:\n");
- printf("\n");
- printf(" GTFCALC 640 480 31.5 KHz\n");
- printf("\n");
- printf("For example to generate timings for 640x480 with a 25.175Mhz dot clock:\n");
- printf("\n");
- printf(" GTFCALC 640 480 25.175 MHz\n");
- printf("\n");
- printf("GTFCALC will print a summary of the results found, and dump the CRTC\n");
- printf("values to the UVCONFIG.CRT file in the format used by SciTech Display Doctor.\n");
- exit(1);
- }
+ printf("Usage: GTFCALC <xPixels> <yPixels> <freq> [[Hz] [KHz] [MHz]] [I]\n");
+ printf("\n");
+ printf("where <xPixels> is the horizontal resolution of the mode, <yPixels> is the\n");
+ printf("vertical resolution of the mode. The <freq> value will be the frequency to\n");
+ printf("drive the calculations, and will be either the vertical frequency (in Hz)\n");
+ printf("the horizontal frequency (in KHz) or the dot clock (in MHz). To generate\n");
+ printf("timings for an interlaced mode, add 'I' to the end of the command line.\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 at 60Hz vertical:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 60 Hz\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 at 31.5KHz horizontal:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 31.5 KHz\n");
+ printf("\n");
+ printf("For example to generate timings for 640x480 with a 25.175Mhz dot clock:\n");
+ printf("\n");
+ printf(" GTFCALC 640 480 25.175 MHz\n");
+ printf("\n");
+ printf("GTFCALC will print a summary of the results found, and dump the CRTC\n");
+ printf("values to the UVCONFIG.CRT file in the format used by SciTech Display Doctor.\n");
+ exit(1);
+ }
/* Get values from command line */
xPixels = atof(argv[1]);
@@ -381,33 +381,33 @@ void main(int argc,char *argv[])
/* Compute the CRTC timings */
if (toupper(argv[4][0]) == 'H')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockVF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockVF,false,interlace,&t);
else if (toupper(argv[4][0]) == 'K')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockHF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockHF,false,interlace,&t);
else if (toupper(argv[4][0]) == 'M')
- GTF_calcTimings(xPixels,yPixels,freq,GTF_lockPF,false,interlace,&t);
+ GTF_calcTimings(xPixels,yPixels,freq,GTF_lockPF,false,interlace,&t);
else {
- printf("Unknown command line!\n");
- exit(1);
- }
+ printf("Unknown command line!\n");
+ exit(1);
+ }
/* Dump summary info to standard output */
printf("CRTC values for %.0fx%.0f @ %.2f %s\n", xPixels, yPixels, freq, argv[4]);
printf("\n");
printf(" hTotal = %-4d vTotal = %-4d\n",
- t.h.hTotal, t.v.vTotal);
+ t.h.hTotal, t.v.vTotal);
printf(" hDisp = %-4d vDisp = %-4d\n",
- t.h.hDisp, t.v.vDisp);
+ t.h.hDisp, t.v.vDisp);
printf(" hSyncStart = %-4d vSyncStart = %-4d\n",
- t.h.hSyncStart, t.v.vSyncStart);
+ t.h.hSyncStart, t.v.vSyncStart);
printf(" hSyncEnd = %-4d vSyncEnd = %-4d\n",
- t.h.hSyncEnd, t.v.vSyncEnd);
+ t.h.hSyncEnd, t.v.vSyncEnd);
printf(" hFrontPorch = %-4d vFrontPorch = %-4d\n",
- t.h.hFrontPorch, t.v.vFrontPorch);
+ t.h.hFrontPorch, t.v.vFrontPorch);
printf(" hSyncWidth = %-4d vSyncWidth = %-4d\n",
- t.h.hSyncWidth, t.v.vSyncWidth);
+ t.h.hSyncWidth, t.v.vSyncWidth);
printf(" hBackPorch = %-4d vBackPorch = %-4d\n",
- t.h.hBackPorch, t.v.vBackPorch);
+ t.h.hBackPorch, t.v.vBackPorch);
printf("\n");
printf(" Interlaced = %s\n", (t.interlace == 'I') ? "Yes" : "No");
printf(" H sync pol = %c\n", t.hSyncPol);
@@ -419,18 +419,18 @@ void main(int argc,char *argv[])
/* Dump to file in format used by SciTech Display Doctor */
if ((f = fopen("UVCONFIG.CRT","w")) != NULL) {
- fprintf(f, "[%.0f %.0f]\n", xPixels, yPixels);
- fprintf(f, "%d %d %d %d '%c' %s\n",
- t.h.hTotal, t.h.hDisp,
- t.h.hSyncStart, t.h.hSyncEnd,
- t.hSyncPol, (t.interlace == 'I') ? "I" : "NI");
- fprintf(f, "%d %d %d %d '%c'\n",
- t.v.vTotal, t.v.vDisp,
- t.v.vSyncStart, t.v.vSyncEnd,
- t.vSyncPol);
- fprintf(f, "%.2f\n", t.dotClock);
- fclose(f);
- }
+ fprintf(f, "[%.0f %.0f]\n", xPixels, yPixels);
+ fprintf(f, "%d %d %d %d '%c' %s\n",
+ t.h.hTotal, t.h.hDisp,
+ t.h.hSyncStart, t.h.hSyncEnd,
+ t.hSyncPol, (t.interlace == 'I') ? "I" : "NI");
+ fprintf(f, "%d %d %d %d '%c'\n",
+ t.v.vTotal, t.v.vDisp,
+ t.v.vSyncStart, t.v.vSyncEnd,
+ t.vSyncPol);
+ fprintf(f, "%.2f\n", t.dotClock);
+ fclose(f);
+ }
}
#endif /* TESTING */
diff --git a/board/MAI/bios_emulator/scitech/src/common/libcimp.c b/board/MAI/bios_emulator/scitech/src/common/libcimp.c
index 0eacd120bf..ab73ad578c 100644
--- a/board/MAI/bios_emulator/scitech/src/common/libcimp.c
+++ b/board/MAI/bios_emulator/scitech/src/common/libcimp.c
@@ -270,27 +270,27 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Find an empty file handle to use */
for (i = 3; i < MAX_FILES; i++) {
- if (!openHandles[i])
- break;
- }
+ if (!openHandles[i])
+ break;
+ }
if (openHandles[i])
- return -1;
+ return -1;
/* Find the open flags to use */
if (_oflag & ___O_TRUNC)
- strcpy(mode,"w");
+ strcpy(mode,"w");
else if (_oflag & ___O_CREAT)
- strcpy(mode,"a");
+ strcpy(mode,"a");
else
- strcpy(mode,"r");
+ strcpy(mode,"r");
if (_oflag & ___O_BINARY)
- strcat(mode,"b");
+ strcat(mode,"b");
if (_oflag & ___O_TEXT)
- strcat(mode,"t");
+ strcat(mode,"t");
/* Open the file and store the file handle */
if ((openHandles[i] = fopen(_path,mode)) == NULL)
- return -1;
+ return -1;
return i;
}
@@ -300,25 +300,25 @@ int _CDECL stub_access(const char *_path, int _amode)
int _CDECL stub_close(int _fildes)
{
if (_fildes >= 3 && openHandles[_fildes]) {
- fclose(openHandles[_fildes]);
- openHandles[_fildes] = NULL;
- }
+ fclose(openHandles[_fildes]);
+ openHandles[_fildes] = NULL;
+ }
return 0;
}
off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
{
if (_fildes >= 3) {
- fseek(openHandles[_fildes],_offset,_whence);
- return ftell(openHandles[_fildes]);
- }
+ fseek(openHandles[_fildes],_offset,_whence);
+ return ftell(openHandles[_fildes]);
+ }
return 0;
}
size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fread(_buf,1,_nbyte,openHandles[_fildes]);
+ return fread(_buf,1,_nbyte,openHandles[_fildes]);
return 0;
}
@@ -327,18 +327,18 @@ int _CDECL stub_unlink(const char *_path)
WORD error;
if (initComplete) {
- if (R0_DeleteFile((char*)_path,0,&error))
- return 0;
- return -1;
- }
+ if (R0_DeleteFile((char*)_path,0,&error))
+ return 0;
+ return -1;
+ }
else
- return i_remove(_path);
+ return i_remove(_path);
}
size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
+ return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
return _nbyte;
}
@@ -356,7 +356,7 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
WORD error;
if (initComplete)
- R0_SetFileAttributes((char*)filename,attrib,&error);
+ R0_SetFileAttributes((char*)filename,attrib,&error);
}
/* Return the current date in days since 1/1/1980 */
@@ -380,59 +380,59 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Find an empty file handle to use */
for (i = 3; i < MAX_FILES; i++) {
- if (!openHandles[i])
- break;
- }
+ if (!openHandles[i])
+ break;
+ }
if (openHandles[i])
- return -1;
+ return -1;
/* Find the open flags to use */
if (_oflag & ___O_TRUNC)
- strcpy(mode,"w");
+ strcpy(mode,"w");
else if (_oflag & ___O_CREAT)
- strcpy(mode,"a");
+ strcpy(mode,"a");
else
- strcpy(mode,"r");
+ strcpy(mode,"r");
if (_oflag & ___O_BINARY)
- strcat(mode,"b");
+ strcat(mode,"b");
if (_oflag & ___O_TEXT)
- strcat(mode,"t");
+ strcat(mode,"t");
/* Open the file and store the file handle */
if ((openHandles[i] = fopen(_path,mode)) == NULL)
- return -1;
+ return -1;
return i;
}
int _CDECL stub_close(int _fildes)
{
if (_fildes >= 3 && openHandles[_fildes]) {
- fclose(openHandles[_fildes]);
- openHandles[_fildes] = NULL;
- }
+ fclose(openHandles[_fildes]);
+ openHandles[_fildes] = NULL;
+ }
return 0;
}
off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
{
if (_fildes >= 3) {
- fseek(openHandles[_fildes],_offset,_whence);
- return ftell(openHandles[_fildes]);
- }
+ fseek(openHandles[_fildes],_offset,_whence);
+ return ftell(openHandles[_fildes]);
+ }
return 0;
}
size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fread(_buf,1,_nbyte,openHandles[_fildes]);
+ return fread(_buf,1,_nbyte,openHandles[_fildes]);
return 0;
}
size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
{
if (_fildes >= 3)
- return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
+ return fwrite(_buf,1,_nbyte,openHandles[_fildes]);
return _nbyte;
}
@@ -444,7 +444,7 @@ int _CDECL stub_isatty(int _fildes)
int _CDECL stub_unlink(const char *_path)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return -1;
}
@@ -454,7 +454,7 @@ int _CDECL stub_remove(const char *_filename)
int _CDECL stub_rename(const char *_old, const char *_new)
{
- // TODO: Implement this!
+ /* TODO: Implement this! */
return -1;
}
@@ -462,11 +462,11 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
uint _attr = 0;
if (attrib & __A_RDONLY)
- _attr |= FILE_ATTRIBUTE_READONLY;
+ _attr |= FILE_ATTRIBUTE_READONLY;
if (attrib & __A_HIDDEN)
- _attr |= FILE_ATTRIBUTE_HIDDEN;
+ _attr |= FILE_ATTRIBUTE_HIDDEN;
if (attrib & __A_SYSTEM)
- _attr |= FILE_ATTRIBUTE_SYSTEM;
+ _attr |= FILE_ATTRIBUTE_SYSTEM;
PM_setFileAttr(filename,_attr);
}
@@ -506,7 +506,7 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
{
FILESTATUS3 s;
if (DosQueryPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s)))
- return;
+ return;
s.attrFile = attrib;
DosSetPathInfo((PSZ)filename,FIL_STANDARD,(PVOID)&s,sizeof(s),0L);
}
@@ -528,25 +528,25 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
/* Determine open flags */
if (_oflag & ___O_CREAT) {
- if (_oflag & ___O_EXCL)
- openflag = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- else if (_oflag & ___O_TRUNC)
- openflag = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- else
- openflag = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
- }
+ if (_oflag & ___O_EXCL)
+ openflag = OPEN_ACTION_FAIL_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ else if (_oflag & ___O_TRUNC)
+ openflag = OPEN_ACTION_REPLACE_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ else
+ openflag = OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_CREATE_IF_NEW;
+ }
else if (_oflag & ___O_TRUNC)
- openflag = OPEN_ACTION_REPLACE_IF_EXISTS;
+ openflag = OPEN_ACTION_REPLACE_IF_EXISTS;
else
- openflag = OPEN_ACTION_OPEN_IF_EXISTS;
+ openflag = OPEN_ACTION_OPEN_IF_EXISTS;
/* Determine open mode flags */
if (_oflag & ___O_RDONLY)
- openmode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
+ openmode = OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE;
else if (_oflag & ___O_WRONLY)
- openmode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
+ openmode = OPEN_ACCESS_WRITEONLY | OPEN_SHARE_DENYWRITE;
else
- openmode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
+ openmode = OPEN_ACCESS_READWRITE | OPEN_SHARE_DENYWRITE;
/* Copy the path to a variable on the stack. We need to do this
* for OS/2 as when the drivers are loaded into shared kernel
@@ -555,14 +555,14 @@ int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
*/
strcpy(path,_path);
if (DosOpen(path, &handle, &actiontaken, 0, FILE_NORMAL,
- openflag, openmode, NULL) != NO_ERROR)
- return -1;
+ openflag, openmode, NULL) != NO_ERROR)
+ return -1;
/* Handle append mode of operation */
if (_oflag & ___O_APPEND) {
- if (DosSetFilePtr(handle, 0, FILE_END, &error) != NO_ERROR)
- return -1;
- }
+ if (DosSetFilePtr(handle, 0, FILE_END, &error) != NO_ERROR)
+ return -1;
+ }
return handle;
}
@@ -578,16 +578,16 @@ int _CDECL stub_access(const char *_path, int _amode)
*/
strcpy(path,_path);
if (DosQueryPathInfo(path, FIL_STANDARD, &fs, sizeof(fs)) != NO_ERROR)
- return -1;
+ return -1;
if ((_amode & W_OK) && (fs.attrFile & FILE_READONLY))
- return -1;
+ return -1;
return 0;
}
int _CDECL stub_close(int _fildes)
{
if (DosClose(_fildes) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -596,17 +596,17 @@ off_t _CDECL stub_lseek(int _fildes, off_t _offset, int _whence)
ULONG cbActual, origin;
switch (_whence) {
- case SEEK_CUR:
- origin = FILE_CURRENT;
- break;
- case SEEK_END:
- origin = FILE_END;
- break;
- default:
- origin = FILE_BEGIN;
- }
+ case SEEK_CUR:
+ origin = FILE_CURRENT;
+ break;
+ case SEEK_END:
+ origin = FILE_END;
+ break;
+ default:
+ origin = FILE_BEGIN;
+ }
if (DosSetFilePtr(_fildes, _offset, origin, &cbActual) != NO_ERROR)
- return -1;
+ return -1;
return cbActual;
}
@@ -621,19 +621,19 @@ size_t _CDECL stub_read(int _fildes, void *_buf, size_t _nbyte)
* in kernel space and will cause DosRead to bail internally.
*/
while (_nbyte > BUF_SIZE) {
- if (DosRead(_fildes, file_io_buf, BUF_SIZE, &cbRead) != NO_ERROR)
- return -1;
- cbActual += cbRead;
- memcpy(p,file_io_buf,BUF_SIZE);
- p += BUF_SIZE;
- _nbyte -= BUF_SIZE;
- }
+ if (DosRead(_fildes, file_io_buf, BUF_SIZE, &cbRead) != NO_ERROR)
+ return -1;
+ cbActual += cbRead;
+ memcpy(p,file_io_buf,BUF_SIZE);
+ p += BUF_SIZE;
+ _nbyte -= BUF_SIZE;
+ }
if (_nbyte) {
- if (DosRead(_fildes, file_io_buf, _nbyte, &cbRead) != NO_ERROR)
- return -1;
- cbActual += cbRead;
- memcpy(p,file_io_buf,_nbyte);
- }
+ if (DosRead(_fildes, file_io_buf, _nbyte, &cbRead) != NO_ERROR)
+ return -1;
+ cbActual += cbRead;
+ memcpy(p,file_io_buf,_nbyte);
+ }
return cbActual;
}
@@ -648,19 +648,19 @@ size_t _CDECL stub_write(int _fildes, const void *_buf, size_t _nbyte)
* in kernel space and will cause DosWrite to bail internally.
*/
while (_nbyte > BUF_SIZE) {
- memcpy(file_io_buf,p,BUF_SIZE);
- if (DosWrite(_fildes, file_io_buf, BUF_SIZE, &cbWrite) != NO_ERROR)
- return -1;
- cbActual += cbWrite;
- p += BUF_SIZE;
- _nbyte -= BUF_SIZE;
- }
+ memcpy(file_io_buf,p,BUF_SIZE);
+ if (DosWrite(_fildes, file_io_buf, BUF_SIZE, &cbWrite) != NO_ERROR)
+ return -1;
+ cbActual += cbWrite;
+ p += BUF_SIZE;
+ _nbyte -= BUF_SIZE;
+ }
if (_nbyte) {
- memcpy(file_io_buf,p,_nbyte);
- if (DosWrite(_fildes, file_io_buf, _nbyte, &cbWrite) != NO_ERROR)
- return -1;
- cbActual += cbWrite;
- }
+ memcpy(file_io_buf,p,_nbyte);
+ if (DosWrite(_fildes, file_io_buf, _nbyte, &cbWrite) != NO_ERROR)
+ return -1;
+ cbActual += cbWrite;
+ }
return cbActual;
}
@@ -675,7 +675,7 @@ int _CDECL stub_unlink(const char *_path)
*/
strcpy(path,_path);
if (DosDelete(path) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -684,7 +684,7 @@ int _CDECL stub_isatty(int _fildes)
ULONG htype, flags;
if (DosQueryHType(_fildes, &htype, &flags) != NO_ERROR)
- return 0;
+ return 0;
return ((htype & 0xFF) == HANDTYPE_DEVICE);
}
@@ -700,7 +700,7 @@ int _CDECL stub_remove(const char *_path)
*/
strcpy(path,_path);
if (DosDelete(path) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -717,7 +717,7 @@ int _CDECL stub_rename(const char *_old, const char *_new)
strcpy(old,_old);
strcpy(new,_new);
if (DosMove(old, new) != NO_ERROR)
- return -1;
+ return -1;
return 0;
}
@@ -734,23 +734,23 @@ void _CDECL _OS_setfileattr(const char *filename,unsigned attrib)
int _CDECL stub_open(const char *_path, int _oflag, unsigned _mode)
{
int oflag_tab[] = {
- ___O_RDONLY, O_RDONLY,
- ___O_WRONLY, O_WRONLY,
- ___O_RDWR, O_RDWR,
- ___O_BINARY, O_BINARY,
- ___O_TEXT, O_TEXT,
- ___O_CREAT, O_CREAT,
- ___O_EXCL, O_EXCL,
- ___O_TRUNC, O_TRUNC,
- ___O_APPEND, O_APPEND,
- };
+ ___O_RDONLY, O_RDONLY,
+ ___O_WRONLY, O_WRONLY,
+ ___O_RDWR, O_RDWR,
+ ___O_BINARY, O_BINARY,
+ ___O_TEXT, O_TEXT,
+ ___O_CREAT, O_CREAT,
+ ___O_EXCL, O_EXCL,
+ ___O_TRUNC, O_TRUNC,
+ ___O_APPEND, O_APPEND,
+ };
int i,oflag = 0;
/* Translate the oflag's to the OS dependent versions */
for (i = 0; i < sizeof(oflag_tab) / sizeof(int); i += 2) {
- if (_oflag & oflag_tab[i])
- oflag |= oflag_tab[i+1];
- }
+ if (_oflag & oflag_tab[i])
+ oflag |= oflag_tab[i+1];
+ }
return open(_path,oflag,_mode);
}
@@ -825,4 +825,3 @@ void * _CDECL stub_signal(int sig, void *handler)
return (void*)signal(sig,(__code_ptr)handler);
#endif
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/peloader.c b/board/MAI/bios_emulator/scitech/src/common/peloader.c
index b9bec4aebb..a134bb012f 100644
--- a/board/MAI/bios_emulator/scitech/src/common/peloader.c
+++ b/board/MAI/bios_emulator/scitech/src/common/peloader.c
@@ -79,35 +79,35 @@ static int PE_readHeader(
result = PE_invalidDLLImage;
fseek(f, startOffset, SEEK_SET);
if (fread(&exehdr, 1, sizeof(exehdr), f) != sizeof(exehdr))
- return false;
+ return false;
if (exehdr.signature != 0x5A4D)
- return false;
+ return false;
/* Now seek to the start of the PE header defined at offset 0x3C
* in the MS-DOS EXE header, and read the signature and check it.
*/
fseek(f, startOffset+0x3C, SEEK_SET);
if (fread(&offset, 1, sizeof(offset), f) != sizeof(offset))
- return false;
+ return false;
fseek(f, startOffset+offset, SEEK_SET);
if (fread(&signature, 1, sizeof(signature), f) != sizeof(signature))
- return false;
+ return false;
if (signature != 0x00004550)
- return false;
+ return false;
/* Now read the PE file header and check that it is correct */
if (fread(filehdr, 1, sizeof(*filehdr), f) != sizeof(*filehdr))
- return false;
+ return false;
if (filehdr->Machine != IMAGE_FILE_MACHINE_I386)
- return false;
+ return false;
if (!(filehdr->Characteristics & IMAGE_FILE_32BIT_MACHINE))
- return false;
+ return false;
if (!(filehdr->Characteristics & IMAGE_FILE_DLL))
- return false;
+ return false;
if (fread(opthdr, 1, sizeof(*opthdr), f) != sizeof(*opthdr))
- return false;
+ return false;
if (opthdr->Magic != 0x10B)
- return false;
+ return false;
/* Success, so return true! */
return true;
@@ -138,15 +138,15 @@ ulong PEAPI PE_getFileSize(
/* Read the PE file headers from disk */
if (!PE_readHeader(f,startOffset,&filehdr,&opthdr))
- return 0xFFFFFFFF;
+ return 0xFFFFFFFF;
/* Scan all the section headers summing up the total size */
size = opthdr.SizeOfHeaders;
for (i = 0; i < filehdr.NumberOfSections; i++) {
- if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
- return 0xFFFFFFFF;
- size += secthdr.SizeOfRawData;
- }
+ if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
+ return 0xFFFFFFFF;
+ size += secthdr.SizeOfRawData;
+ }
return size;
}
@@ -199,7 +199,7 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
/* Read the PE file headers from disk */
if (!PE_readHeader(f,startOffset,&filehdr,&opthdr))
- return NULL;
+ return NULL;
/* Scan all the section headers and find the necessary sections */
text_off = data_off = reloc_off = export_off = 0;
@@ -208,56 +208,56 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
export_addr = export_size = export_end = 0;
reloc_size = 0;
for (i = 0; i < filehdr.NumberOfSections; i++) {
- if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
- goto Error;
- if (strcmp(secthdr.Name, ".edata") == 0 || strcmp(secthdr.Name, ".rdata") == 0) {
- /* Exports section */
- export_off = secthdr.PointerToRawData;
- export_addr = secthdr.VirtualAddress;
- export_size = secthdr.SizeOfRawData;
- export_end = export_addr + export_size;
- }
- else if (strcmp(secthdr.Name, ".idata") == 0) {
- /* Imports section, ignore */
- }
- else if (strcmp(secthdr.Name, ".reloc") == 0) {
- /* Relocations section */
- reloc_off = secthdr.PointerToRawData;
- reloc_size = secthdr.SizeOfRawData;
- }
- else if (!text_off && secthdr.Characteristics & IMAGE_SCN_CNT_CODE) {
- /* Code section */
- text_off = secthdr.PointerToRawData;
- text_addr = secthdr.VirtualAddress;
- text_size = secthdr.SizeOfRawData;
- }
- else if (!data_off && secthdr.Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) {
- /* Data section */
- data_off = secthdr.PointerToRawData;
- data_addr = secthdr.VirtualAddress;
- data_size = secthdr.SizeOfRawData;
- data_end = data_addr + data_size;
- }
- }
+ if (fread(&secthdr, 1, sizeof(secthdr), f) != sizeof(secthdr))
+ goto Error;
+ if (strcmp(secthdr.Name, ".edata") == 0 || strcmp(secthdr.Name, ".rdata") == 0) {
+ /* Exports section */
+ export_off = secthdr.PointerToRawData;
+ export_addr = secthdr.VirtualAddress;
+ export_size = secthdr.SizeOfRawData;
+ export_end = export_addr + export_size;
+ }
+ else if (strcmp(secthdr.Name, ".idata") == 0) {
+ /* Imports section, ignore */
+ }
+ else if (strcmp(secthdr.Name, ".reloc") == 0) {
+ /* Relocations section */
+ reloc_off = secthdr.PointerToRawData;
+ reloc_size = secthdr.SizeOfRawData;
+ }
+ else if (!text_off && secthdr.Characteristics & IMAGE_SCN_CNT_CODE) {
+ /* Code section */
+ text_off = secthdr.PointerToRawData;
+ text_addr = secthdr.VirtualAddress;
+ text_size = secthdr.SizeOfRawData;
+ }
+ else if (!data_off && secthdr.Characteristics & IMAGE_SCN_CNT_INITIALIZED_DATA) {
+ /* Data section */
+ data_off = secthdr.PointerToRawData;
+ data_addr = secthdr.VirtualAddress;
+ data_size = secthdr.SizeOfRawData;
+ data_end = data_addr + data_size;
+ }
+ }
/* Check to make sure that we have all the sections we need */
if (!text_off || !data_off || !export_off || !reloc_off) {
- result = PE_invalidDLLImage;
- goto Error;
- }
+ result = PE_invalidDLLImage;
+ goto Error;
+ }
/* Find the size of the image to load allocate memory for it */
image_size = MAX(export_end,data_end) - text_addr;
*size = sizeof(PE_MODULE) + image_size + 4096;
if (shared)
- hMod = PM_mallocShared(*size);
+ hMod = PM_mallocShared(*size);
else
- hMod = PM_malloc(*size);
+ hMod = PM_malloc(*size);
reloc = PM_malloc(reloc_size);
if (!hMod || !reloc) {
- result = PE_outOfMemory;
- goto Error;
- }
+ result = PE_outOfMemory;
+ goto Error;
+ }
hMod->text = (uchar*)ROUND_4K((ulong)hMod + sizeof(PE_MODULE));
hMod->data = (uchar*)((ulong)hMod->text + (data_addr - text_addr));
@@ -272,48 +272,48 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
result = PE_invalidDLLImage;
fseek(f, startOffset+text_off, SEEK_SET);
if (fread(hMod->text, 1, text_size, f) != text_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+data_off, SEEK_SET);
if (fread(hMod->data, 1, data_size, f) != data_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+export_off, SEEK_SET);
if (fread(hMod->export, 1, export_size, f) != export_size)
- goto Error;
+ goto Error;
fseek(f, startOffset+reloc_off, SEEK_SET);
if (fread(reloc, 1, reloc_size, f) != reloc_size)
- goto Error;
+ goto Error;
/* Now perform relocations on all sections in the image */
delta = (ulong)hMod->text - opthdr.ImageBase - text_addr;
baseReloc = (BASE_RELOCATION*)reloc;
for (;;) {
- /* Check for termination condition */
- if (!baseReloc->PageRVA || !baseReloc->BlockSize)
- break;
-
- /* Do fixups */
- pageOffset = baseReloc->PageRVA - hMod->textBase;
- numFixups = (baseReloc->BlockSize - sizeof(BASE_RELOCATION)) / sizeof(ushort);
- fixup = (ushort*)(baseReloc + 1);
- for (i = 0; i < numFixups; i++) {
- relocType = *fixup >> 12;
- if (relocType) {
- offset = pageOffset + (*fixup & 0x0FFF);
- *(ulong*)(hMod->text + offset) += delta;
- }
- fixup++;
- }
-
- /* Move to next relocation block */
- baseReloc = (BASE_RELOCATION*)((ulong)baseReloc + baseReloc->BlockSize);
- }
+ /* Check for termination condition */
+ if (!baseReloc->PageRVA || !baseReloc->BlockSize)
+ break;
+
+ /* Do fixups */
+ pageOffset = baseReloc->PageRVA - hMod->textBase;
+ numFixups = (baseReloc->BlockSize - sizeof(BASE_RELOCATION)) / sizeof(ushort);
+ fixup = (ushort*)(baseReloc + 1);
+ for (i = 0; i < numFixups; i++) {
+ relocType = *fixup >> 12;
+ if (relocType) {
+ offset = pageOffset + (*fixup & 0x0FFF);
+ *(ulong*)(hMod->text + offset) += delta;
+ }
+ fixup++;
+ }
+
+ /* Move to next relocation block */
+ baseReloc = (BASE_RELOCATION*)((ulong)baseReloc + baseReloc->BlockSize);
+ }
/* Initialise the C runtime library for the loaded DLL */
result = PE_unableToInitLibC;
if ((InitLibC = (InitLibC_t)PE_getProcAddress(hMod,"_InitLibC")) == NULL)
- goto Error;
+ goto Error;
if (!InitLibC(&___imports,PM_getOSType()))
- goto Error;
+ goto Error;
/* Clean up, close the file and return the loaded module handle */
PM_free(reloc);
@@ -322,9 +322,9 @@ PE_MODULE * PEAPI PE_loadLibraryExt(
Error:
if (shared)
- PM_freeShared(hMod);
+ PM_freeShared(hMod);
else
- PM_free(hMod);
+ PM_free(hMod);
PM_free(reloc);
return NULL;
}
@@ -360,53 +360,53 @@ PE_MODULE * PEAPI PE_loadLibrary(
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (!shared) {
- PM_MODULE hInst;
- InitLibC_t InitLibC;
-
- /* For Win32 if are building checked libraries for debugging, we use
- * the real Win32 DLL functions so that we can debug the resulting DLL
- * files with the Win32 debuggers. Note that we can't do this if
- * we need to load the files into a shared memory context.
- */
- if ((hInst = PM_loadLibrary(szDLLName)) == NULL) {
- result = PE_fileNotFound;
- return NULL;
- }
-
- /* Initialise the C runtime library for the loaded DLL */
- result = PE_unableToInitLibC;
- if ((InitLibC = (void*)PM_getProcAddress(hInst,"_InitLibC")) == NULL)
- return NULL;
- if (!InitLibC(&___imports,PM_getOSType()))
- return NULL;
-
- /* Allocate the PE_MODULE structure */
- if ((hMod = PM_malloc(sizeof(*hMod))) == NULL)
- return NULL;
- hMod->text = (void*)hInst;
- hMod->shared = -1;
-
- /* DLL loaded successfully so return module handle */
- result = PE_ok;
- return hMod;
- }
+ PM_MODULE hInst;
+ InitLibC_t InitLibC;
+
+ /* For Win32 if are building checked libraries for debugging, we use
+ * the real Win32 DLL functions so that we can debug the resulting DLL
+ * files with the Win32 debuggers. Note that we can't do this if
+ * we need to load the files into a shared memory context.
+ */
+ if ((hInst = PM_loadLibrary(szDLLName)) == NULL) {
+ result = PE_fileNotFound;
+ return NULL;
+ }
+
+ /* Initialise the C runtime library for the loaded DLL */
+ result = PE_unableToInitLibC;
+ if ((InitLibC = (void*)PM_getProcAddress(hInst,"_InitLibC")) == NULL)
+ return NULL;
+ if (!InitLibC(&___imports,PM_getOSType()))
+ return NULL;
+
+ /* Allocate the PE_MODULE structure */
+ if ((hMod = PM_malloc(sizeof(*hMod))) == NULL)
+ return NULL;
+ hMod->text = (void*)hInst;
+ hMod->shared = -1;
+
+ /* DLL loaded successfully so return module handle */
+ result = PE_ok;
+ return hMod;
+ }
else
#endif
- {
- FILE *f;
- ulong size;
-
- /* Attempt to open the file on disk */
- if (shared < 0)
- shared = 0;
- if ((f = fopen(szDLLName,"rb")) == NULL) {
- result = PE_fileNotFound;
- return NULL;
- }
- hMod = PE_loadLibraryExt(f,0,&size,shared);
- fclose(f);
- return hMod;
- }
+ {
+ FILE *f;
+ ulong size;
+
+ /* Attempt to open the file on disk */
+ if (shared < 0)
+ shared = 0;
+ if ((f = fopen(szDLLName,"rb")) == NULL) {
+ result = PE_fileNotFound;
+ return NULL;
+ }
+ hMod = PE_loadLibraryExt(f,0,&size,shared);
+ fclose(f);
+ return hMod;
+ }
}
/****************************************************************************
@@ -445,14 +445,14 @@ PE_MODULE * PEAPI PE_loadLibraryMGL(
*/
#if !defined(__WIN32_VXD__) && !defined(__NT_DRIVER__)
if (getenv("MGL_ROOT")) {
- strcpy(path,getenv("MGL_ROOT"));
- PM_backslash(path);
- }
+ strcpy(path,getenv("MGL_ROOT"));
+ PM_backslash(path);
+ }
strcat(path,"drivers");
PM_backslash(path);
strcat(path,szDLLName);
if ((hMod = PE_loadLibrary(path,shared)) != NULL)
- return hMod;
+ return hMod;
#endif
strcpy(path,"drivers");
PM_backslash(path);
@@ -488,39 +488,39 @@ void * PEAPI PE_getProcAddress(
{
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (hModule->shared == -1)
- return (void*)PM_getProcAddress(hModule->text,szProcName);
+ return (void*)PM_getProcAddress(hModule->text,szProcName);
else
#endif
- {
- uint i;
- EXPORT_DIRECTORY *exports;
- ulong funcOffset;
- ulong *AddressTable;
- ulong *NameTable;
- ushort *OrdinalTable;
- char *name;
-
- /* Find the address of the export tables from the export section */
- if (!hModule)
- return NULL;
- exports = (EXPORT_DIRECTORY*)(hModule->export + hModule->exportDir);
- AddressTable = (ulong*)(hModule->export + exports->AddressTableRVA - hModule->exportBase);
- NameTable = (ulong*)(hModule->export + exports->NameTableRVA - hModule->exportBase);
- OrdinalTable = (ushort*)(hModule->export + exports->OrdinalTableRVA - hModule->exportBase);
-
- /* Search the export name table to find the function name */
- for (i = 0; i < exports->NumberOfNamePointers; i++) {
- name = (char*)(hModule->export + NameTable[i] - hModule->exportBase);
- if (strcmp(name,szProcName) == 0)
- break;
- }
- if (i == exports->NumberOfNamePointers)
- return NULL;
- funcOffset = AddressTable[OrdinalTable[i]];
- if (!funcOffset)
- return NULL;
- return (void*)(hModule->text + funcOffset - hModule->textBase);
- }
+ {
+ uint i;
+ EXPORT_DIRECTORY *exports;
+ ulong funcOffset;
+ ulong *AddressTable;
+ ulong *NameTable;
+ ushort *OrdinalTable;
+ char *name;
+
+ /* Find the address of the export tables from the export section */
+ if (!hModule)
+ return NULL;
+ exports = (EXPORT_DIRECTORY*)(hModule->export + hModule->exportDir);
+ AddressTable = (ulong*)(hModule->export + exports->AddressTableRVA - hModule->exportBase);
+ NameTable = (ulong*)(hModule->export + exports->NameTableRVA - hModule->exportBase);
+ OrdinalTable = (ushort*)(hModule->export + exports->OrdinalTableRVA - hModule->exportBase);
+
+ /* Search the export name table to find the function name */
+ for (i = 0; i < exports->NumberOfNamePointers; i++) {
+ name = (char*)(hModule->export + NameTable[i] - hModule->exportBase);
+ if (strcmp(name,szProcName) == 0)
+ break;
+ }
+ if (i == exports->NumberOfNamePointers)
+ return NULL;
+ funcOffset = AddressTable[OrdinalTable[i]];
+ if (!funcOffset)
+ return NULL;
+ return (void*)(hModule->text + funcOffset - hModule->textBase);
+ }
}
/****************************************************************************
@@ -546,25 +546,25 @@ void PEAPI PE_freeLibrary(
#if (defined(__WINDOWS32__) || defined(__DRIVER__)) && defined(CHECKED)
if (hModule->shared == -1) {
- /* Run the C runtime library exit code on module unload */
- if ((TerminateLibC = (TerminateLibC_t)PM_getProcAddress(hModule->text,"_TerminateLibC")) != NULL)
- TerminateLibC();
- PM_freeLibrary(hModule->text);
- PM_free(hModule);
- }
+ /* Run the C runtime library exit code on module unload */
+ if ((TerminateLibC = (TerminateLibC_t)PM_getProcAddress(hModule->text,"_TerminateLibC")) != NULL)
+ TerminateLibC();
+ PM_freeLibrary(hModule->text);
+ PM_free(hModule);
+ }
else
#endif
- {
- if (hModule) {
- /* Run the C runtime library exit code on module unload */
- if ((TerminateLibC = (TerminateLibC_t)PE_getProcAddress(hModule,"_TerminateLibC")) != NULL)
- TerminateLibC();
- if (hModule->shared)
- PM_freeShared(hModule);
- else
- PM_free(hModule);
- }
- }
+ {
+ if (hModule) {
+ /* Run the C runtime library exit code on module unload */
+ if ((TerminateLibC = (TerminateLibC_t)PE_getProcAddress(hModule,"_TerminateLibC")) != NULL)
+ TerminateLibC();
+ if (hModule->shared)
+ PM_freeShared(hModule);
+ else
+ PM_free(hModule);
+ }
+ }
}
/****************************************************************************
@@ -584,4 +584,3 @@ int PEAPI PE_getError(void)
{
return result;
}
-
diff --git a/board/MAI/bios_emulator/scitech/src/common/vesavbe.c b/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
index 2be57e2bd3..a669e5c292 100644
--- a/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
+++ b/board/MAI/bios_emulator/scitech/src/common/vesavbe.c
@@ -73,10 +73,10 @@ void VBEAPI VBE_init(void)
****************************************************************************/
{
if (!state->VESABuf_ptr) {
- /* Allocate a global buffer for communicating with the VESA VBE */
- if ((state->VESABuf_ptr = PM_getVESABuf(&VESABuf_len, &state->VESABuf_rseg, &state->VESABuf_roff)) == NULL)
- PM_fatalError("VESAVBE.C: Real mode memory allocation failed!");
- }
+ /* Allocate a global buffer for communicating with the VESA VBE */
+ if ((state->VESABuf_ptr = PM_getVESABuf(&VESABuf_len, &state->VESABuf_rseg, &state->VESABuf_roff)) == NULL)
+ PM_fatalError("VESAVBE.C: Real mode memory allocation failed!");
+ }
}
void * VBEAPI VBE_getRMBuf(uint *len,uint *rseg,uint *roff)
@@ -129,7 +129,7 @@ void VBEAPI VBE_callESDI(RMREGS *regs, void *buffer, int size)
RMSREGS sregs;
if (!state->VESABuf_ptr)
- PM_fatalError("You *MUST* call VBE_init() before you can call the VESAVBE.C module!");
+ PM_fatalError("You *MUST* call VBE_init() before you can call the VESAVBE.C module!");
sregs.es = (ushort)state->VESABuf_rseg;
regs->x.di = (ushort)state->VESABuf_roff;
memcpy(state->VESABuf_ptr, buffer, size);
@@ -157,7 +157,7 @@ static char *VBE_copyStrToLocal(char *p,char *realPtr,char *max)
v = PM_mapRealPointer((uint)((ulong)realPtr >> 16), (uint)((ulong)realPtr & 0xFFFF));
while (*v != 0 && p < max)
- *p++ = *v++;
+ *p++ = *v++;
*p++ = 0;
return p;
}
@@ -178,7 +178,7 @@ static void VBE_copyShortToLocal(ushort *p,ushort *realPtr)
v = PM_mapRealPointer((uint)((ulong)realPtr >> 16),(uint)((ulong)realPtr & 0xFFFF));
while (*v != 0xFFFF)
- *p++ = *v++;
+ *p++ = *v++;
*p = 0xFFFF;
}
#endif
@@ -200,26 +200,26 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
regs.x.ax = 0x4F00; /* Get SuperVGA information */
if (forceUniVBE) {
- regs.x.bx = 0x1234;
- regs.x.cx = 0x4321;
- }
+ regs.x.bx = 0x1234;
+ regs.x.cx = 0x4321;
+ }
else {
- regs.x.bx = 0;
- regs.x.cx = 0;
- }
+ regs.x.bx = 0;
+ regs.x.cx = 0;
+ }
strncpy(vgaInfo->VESASignature,"VBE2",4);
VBE_callESDI(&regs, vgaInfo, sizeof(*vgaInfo));
if (regs.x.ax != VBE_SUCCESS)
- return 0;
+ return 0;
if (strncmp(vgaInfo->VESASignature,"VESA",4) != 0)
- return 0;
+ return 0;
/* Check for bogus BIOSes that return a VBE version number that is
* not correct, and fix it up. We also check the OemVendorNamePtr for a
* valid value, and if it is invalid then we also reset to VBE 1.2.
*/
if (vgaInfo->VESAVersion >= 0x200 && vgaInfo->OemVendorNamePtr == 0)
- vgaInfo->VESAVersion = 0x102;
+ vgaInfo->VESAVersion = 0x102;
#ifndef REALMODE
/* Relocate all the indirect information (mode tables, OEM strings
* etc) from the low 1Mb memory region into a static buffer in
@@ -227,23 +227,23 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
* from mapping the strings from real mode to protected mode.
*/
{
- char *p,*p2;
+ char *p,*p2;
p2 = VBE_copyStrToLocal(localBuf,vgaInfo->OemStringPtr,MAX_LOCAL_BUF);
vgaInfo->OemStringPtr = localBuf;
if (vgaInfo->VESAVersion >= 0x200) {
- p = VBE_copyStrToLocal(p2,vgaInfo->OemVendorNamePtr,MAX_LOCAL_BUF);
- vgaInfo->OemVendorNamePtr = p2;
- p2 = VBE_copyStrToLocal(p,vgaInfo->OemProductNamePtr,MAX_LOCAL_BUF);
- vgaInfo->OemProductNamePtr = p;
- p = VBE_copyStrToLocal(p2,vgaInfo->OemProductRevPtr,MAX_LOCAL_BUF);
- vgaInfo->OemProductRevPtr = p2;
- VBE_copyShortToLocal((ushort*)p,vgaInfo->VideoModePtr);
- vgaInfo->VideoModePtr = (ushort*)p;
- }
+ p = VBE_copyStrToLocal(p2,vgaInfo->OemVendorNamePtr,MAX_LOCAL_BUF);
+ vgaInfo->OemVendorNamePtr = p2;
+ p2 = VBE_copyStrToLocal(p,vgaInfo->OemProductNamePtr,MAX_LOCAL_BUF);
+ vgaInfo->OemProductNamePtr = p;
+ p = VBE_copyStrToLocal(p2,vgaInfo->OemProductRevPtr,MAX_LOCAL_BUF);
+ vgaInfo->OemProductRevPtr = p2;
+ VBE_copyShortToLocal((ushort*)p,vgaInfo->VideoModePtr);
+ vgaInfo->VideoModePtr = (ushort*)p;
+ }
else {
- VBE_copyShortToLocal((ushort*)p2,vgaInfo->VideoModePtr);
- vgaInfo->VideoModePtr = (ushort*)p2;
- }
+ VBE_copyShortToLocal((ushort*)p2,vgaInfo->VideoModePtr);
+ vgaInfo->VideoModePtr = (ushort*)p2;
+ }
}
#endif
state->VBEMemory = vgaInfo->TotalMemory * 64;
@@ -253,17 +253,17 @@ int VBEAPI VBE_detectEXT(VBE_vgaInfo *vgaInfo,ibool forceUniVBE)
*/
haveRiva128 = false;
if (vgaInfo->VESAVersion >= 0x300 &&
- (strstr(vgaInfo->OemStringPtr,"NVidia") != NULL ||
- strstr(vgaInfo->OemStringPtr,"Riva") != NULL)) {
- haveRiva128 = true;
- }
+ (strstr(vgaInfo->OemStringPtr,"NVidia") != NULL ||
+ strstr(vgaInfo->OemStringPtr,"Riva") != NULL)) {
+ haveRiva128 = true;
+ }
/* Check for Matrox G400 cards which claim to be VBE 3.0
* compliant yet they don't implement the refresh rate control
* functions.
*/
if (vgaInfo->VESAVersion >= 0x300 && (strcmp(vgaInfo->OemProductNamePtr,"Matrox G400") == 0))
- vgaInfo->VESAVersion = 0x200;
+ vgaInfo->VESAVersion = 0x200;
return (state->VBEVersion = vgaInfo->VESAVersion);
}
@@ -305,70 +305,70 @@ ibool VBEAPI VBE_getModeInfo(int mode,VBE_modeInfo *modeInfo)
regs.x.cx = (ushort)mode;
VBE_callESDI(&regs, modeInfo, sizeof(*modeInfo));
if (regs.x.ax != VBE_SUCCESS)
- return false;
+ return false;
if ((modeInfo->ModeAttributes & vbeMdAvailable) == 0)
- return false;
+ return false;
/* Map out triple buffer and stereo flags for NVidia Riva128
* chips.
*/
if (haveRiva128) {
- modeInfo->ModeAttributes &= ~vbeMdTripleBuf;
- modeInfo->ModeAttributes &= ~vbeMdStereo;
- }
+ modeInfo->ModeAttributes &= ~vbeMdTripleBuf;
+ modeInfo->ModeAttributes &= ~vbeMdStereo;
+ }
/* Support old style RGB definitions for VBE 1.1 BIOSes */
bits = modeInfo->BitsPerPixel;
if (modeInfo->MemoryModel == vbeMemPK && bits > 8) {
- modeInfo->MemoryModel = vbeMemRGB;
- switch (bits) {
- case 15:
- modeInfo->RedMaskSize = 5;
- modeInfo->RedFieldPosition = 10;
- modeInfo->GreenMaskSize = 5;
- modeInfo->GreenFieldPosition = 5;
- modeInfo->BlueMaskSize = 5;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 1;
- modeInfo->RsvdFieldPosition = 15;
- break;
- case 16:
- modeInfo->RedMaskSize = 5;
- modeInfo->RedFieldPosition = 11;
- modeInfo->GreenMaskSize = 5;
- modeInfo->GreenFieldPosition = 5;
- modeInfo->BlueMaskSize = 5;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 0;
- modeInfo->RsvdFieldPosition = 0;
- break;
- case 24:
- modeInfo->RedMaskSize = 8;
- modeInfo->RedFieldPosition = 16;
- modeInfo->GreenMaskSize = 8;
- modeInfo->GreenFieldPosition = 8;
- modeInfo->BlueMaskSize = 8;
- modeInfo->BlueFieldPosition = 0;
- modeInfo->RsvdMaskSize = 0;
- modeInfo->RsvdFieldPosition = 0;
- break;
- }
- }
+ modeInfo->MemoryModel = vbeMemRGB;
+ switch (bits) {
+ case 15:
+ modeInfo->RedMaskSize = 5;
+ modeInfo->RedFieldPosition = 10;
+ modeInfo->GreenMaskSize = 5;
+ modeInfo->GreenFieldPosition = 5;
+ modeInfo->BlueMaskSize = 5;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 1;
+ modeInfo->RsvdFieldPosition = 15;
+ break;
+ case 16:
+ modeInfo->RedMaskSize = 5;
+ modeInfo->RedFieldPosition = 11;
+ modeInfo->GreenMaskSize = 5;
+ modeInfo->GreenFieldPosition = 5;
+ modeInfo->BlueMaskSize = 5;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 0;
+ modeInfo->RsvdFieldPosition = 0;
+ break;
+ case 24:
+ modeInfo->RedMaskSize = 8;
+ modeInfo->RedFieldPosition = 16;
+ modeInfo->GreenMaskSize = 8;
+ modeInfo->GreenFieldPosition = 8;
+ modeInfo->BlueMaskSize = 8;
+ modeInfo->BlueFieldPosition = 0;
+ modeInfo->RsvdMaskSize = 0;
+ modeInfo->RsvdFieldPosition = 0;
+ break;
+ }
+ }
/* Convert the 32k direct color modes of VBE 1.2+ BIOSes to
* be recognised as 15 bits per pixel modes.
*/
if (bits == 16 && modeInfo->RsvdMaskSize == 1)
- modeInfo->BitsPerPixel = 15;
+ modeInfo->BitsPerPixel = 15;
/* Fix up bogus BIOS'es that report incorrect reserved pixel masks
* for 32K color modes. Quite a number of BIOS'es have this problem,
* and this affects our OS/2 drivers in VBE fallback mode.
*/
if (bits == 15 && (modeInfo->RsvdMaskSize != 1 || modeInfo->RsvdFieldPosition != 15)) {
- modeInfo->RsvdMaskSize = 1;
- modeInfo->RsvdFieldPosition = 15;
- }
+ modeInfo->RsvdMaskSize = 1;
+ modeInfo->RsvdFieldPosition = 15;
+ }
return true;
}
@@ -391,20 +391,20 @@ long VBEAPI VBE_getPageSize(VBE_modeInfo *mi)
size = (long)mi->BytesPerScanLine * (long)mi->YResolution;
if (mi->BitsPerPixel == 4) {
- /* We have a 16 color video mode, so round up the page size to
- * 8k, 16k, 32k or 64k boundaries depending on how large it is.
- */
-
- size = (size + 0x1FFFL) & 0xFFFFE000L;
- if (size != 0x2000) {
- size = (size + 0x3FFFL) & 0xFFFFC000L;
- if (size != 0x4000) {
- size = (size + 0x7FFFL) & 0xFFFF8000L;
- if (size != 0x8000)
- size = (size + 0xFFFFL) & 0xFFFF0000L;
- }
- }
- }
+ /* We have a 16 color video mode, so round up the page size to
+ * 8k, 16k, 32k or 64k boundaries depending on how large it is.
+ */
+
+ size = (size + 0x1FFFL) & 0xFFFFE000L;
+ if (size != 0x2000) {
+ size = (size + 0x3FFFL) & 0xFFFFC000L;
+ if (size != 0x4000) {
+ size = (size + 0x7FFFL) & 0xFFFF8000L;
+ if (size != 0x8000)
+ size = (size + 0xFFFFL) & 0xFFFF0000L;
+ }
+ }
+ }
else size = (size + 0xFFFFL) & 0xFFFF0000L;
return size;
}
@@ -425,26 +425,26 @@ ibool VBEAPI VBE_setVideoModeExt(int mode,VBE_CRTCInfo *crtc)
RMREGS regs;
if (state->VBEVersion < 0x200 && mode < 0x100) {
- /* Some VBE implementations barf terribly if you try to set non-VBE
- * video modes with the VBE set mode call. VBE 2.0 implementations
- * must be able to handle this.
- */
- regs.h.al = (ushort)mode;
- regs.h.ah = 0;
- PM_int86(0x10,&regs,&regs);
- }
+ /* Some VBE implementations barf terribly if you try to set non-VBE
+ * video modes with the VBE set mode call. VBE 2.0 implementations
+ * must be able to handle this.
+ */
+ regs.h.al = (ushort)mode;
+ regs.h.ah = 0;
+ PM_int86(0x10,&regs,&regs);
+ }
else {
- if (state->VBEVersion < 0x300 && (mode & vbeRefreshCtrl))
- return false;
- regs.x.ax = 0x4F02;
- regs.x.bx = (ushort)mode;
- if ((mode & vbeRefreshCtrl) && crtc)
- VBE_callESDI(&regs, crtc, sizeof(*crtc));
- else
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax != VBE_SUCCESS)
- return false;
- }
+ if (state->VBEVersion < 0x300 && (mode & vbeRefreshCtrl))
+ return false;
+ regs.x.ax = 0x4F02;
+ regs.x.bx = (ushort)mode;
+ if ((mode & vbeRefreshCtrl) && crtc)
+ VBE_callESDI(&regs, crtc, sizeof(*crtc));
+ else
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax != VBE_SUCCESS)
+ return false;
+ }
return true;
}
@@ -475,7 +475,7 @@ int VBEAPI VBE_getVideoMode(void)
regs.x.ax = 0x4F03;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.x.bx;
}
@@ -515,7 +515,7 @@ int VBEAPI VBE_getBank(int window)
regs.h.bl = window;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.x.dx;
}
@@ -637,7 +637,7 @@ ibool VBEAPI VBE_setDisplayStart(int x,int y,ibool waitVRT)
regs.x.ax = 0x4F07;
if (waitVRT)
- regs.x.bx = 0x80;
+ regs.x.bx = 0x80;
else regs.x.bx = 0x00;
regs.x.cx = x;
regs.x.dx = y;
@@ -685,12 +685,12 @@ ibool VBEAPI VBE_setDisplayStartAlt(ulong startAddr,ibool waitVRT)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = waitVRT ? 0x82 : 0x02;
- regs.e.ecx = startAddr;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = waitVRT ? 0x82 : 0x02;
+ regs.e.ecx = startAddr;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -712,12 +712,12 @@ int VBEAPI VBE_getDisplayStartStatus(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0004;
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax == VBE_SUCCESS)
- return (regs.x.cx != 0);
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0004;
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax == VBE_SUCCESS)
+ return (regs.x.cx != 0);
+ }
return -1;
}
@@ -738,11 +738,11 @@ ibool VBEAPI VBE_enableStereoMode(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0005;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0005;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -762,11 +762,11 @@ ibool VBEAPI VBE_disableStereoMode(void)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = 0x0006;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = 0x0006;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -793,13 +793,13 @@ ibool VBEAPI VBE_setStereoDisplayStart(ulong leftAddr,ulong rightAddr,
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F07;
- regs.x.bx = waitVRT ? 0x83 : 0x03;
- regs.e.ecx = leftAddr;
- regs.e.edx = rightAddr;
- PM_int86(0x10,&regs,&regs);
- return regs.x.ax == VBE_SUCCESS;
- }
+ regs.x.ax = 0x4F07;
+ regs.x.bx = waitVRT ? 0x83 : 0x03;
+ regs.e.ecx = leftAddr;
+ regs.e.edx = rightAddr;
+ PM_int86(0x10,&regs,&regs);
+ return regs.x.ax == VBE_SUCCESS;
+ }
return false;
}
@@ -832,14 +832,14 @@ ulong VBEAPI VBE_getClosestClock(ushort mode,ulong pixelClock)
RMREGS regs;
if (state->VBEVersion >= 0x300) {
- regs.x.ax = 0x4F0B;
- regs.h.bl = 0x00;
- regs.e.ecx = pixelClock;
- regs.x.dx = mode;
- PM_int86(0x10,&regs,&regs);
- if (regs.x.ax == VBE_SUCCESS)
- return regs.e.ecx;
- }
+ regs.x.ax = 0x4F0B;
+ regs.h.bl = 0x00;
+ regs.e.ecx = pixelClock;
+ regs.x.dx = mode;
+ PM_int86(0x10,&regs,&regs);
+ if (regs.x.ax == VBE_SUCCESS)
+ return regs.e.ecx;
+ }
return -1;
}
@@ -875,7 +875,7 @@ int VBEAPI VBE_getDACWidth(void)
regs.h.bl = 0x01;
PM_int86(0x10,&regs,&regs);
if (regs.x.ax != VBE_SUCCESS)
- return -1;
+ return -1;
return regs.h.bh;
}
@@ -927,11 +927,11 @@ void * VBEAPI VBE_getBankedPointer(VBE_modeInfo *modeInfo)
*/
ulong seg = (ushort)modeInfo->WinASegment;
if (seg != 0) {
- if (seg == 0xA000)
- return (void*)PM_getA0000Pointer();
- else
- return (void*)PM_mapPhysicalAddr(seg << 4,0xFFFF,true);
- }
+ if (seg == 0xA000)
+ return (void*)PM_getA0000Pointer();
+ else
+ return (void*)PM_mapPhysicalAddr(seg << 4,0xFFFF,true);
+ }
return NULL;
}
@@ -956,14 +956,14 @@ void * VBEAPI VBE_getLinearPointer(VBE_modeInfo *modeInfo)
/* Search for an already mapped pointer */
for (i = 0; i < numPtrs; i++) {
- if (physPtr[i] == modeInfo->PhysBasePtr)
- return linPtr[i];
- }
+ if (physPtr[i] == modeInfo->PhysBasePtr)
+ return linPtr[i];
+ }
if (numPtrs < MAX_LIN_PTRS) {
- physPtr[numPtrs] = modeInfo->PhysBasePtr;
- linPtr[numPtrs] = PM_mapPhysicalAddr(modeInfo->PhysBasePtr,(state->VBEMemory * 1024L)-1,true);
- return linPtr[numPtrs++];
- }
+ physPtr[numPtrs] = modeInfo->PhysBasePtr;
+ linPtr[numPtrs] = PM_mapPhysicalAddr(modeInfo->PhysBasePtr,(state->VBEMemory * 1024L)-1,true);
+ return linPtr[numPtrs++];
+ }
return NULL;
}
@@ -989,56 +989,56 @@ static void InitPMCode(void)
int pmLen;
if (!state->pmInfo && state->VBEVersion >= 0x200) {
- regs.x.ax = 0x4F0A;
- regs.x.bx = 0;
- PM_int86x(0x10,&regs,&regs,&sregs);
- if (regs.x.ax != VBE_SUCCESS)
- return;
- if (VBE_shared)
- state->pmInfo = PM_mallocShared(regs.x.cx);
- else
- state->pmInfo = PM_malloc(regs.x.cx);
- if (state->pmInfo == NULL)
- return;
- state->pmInfo32 = state->pmInfo;
- pmLen = regs.x.cx;
-
- /* Relocate the block into our local data segment */
- code = PM_mapRealPointer(sregs.es,regs.x.di);
- memcpy(state->pmInfo,code,pmLen);
-
- /* Now do a sanity check on the information we recieve to ensure
- * that is is correct. Some BIOS return totally bogus information
- * in here (Matrox is one)! Under DOS this works OK, but under OS/2
- * we are screwed.
- */
- if (state->pmInfo->setWindow >= pmLen ||
- state->pmInfo->setDisplayStart >= pmLen ||
- state->pmInfo->setPalette >= pmLen ||
- state->pmInfo->IOPrivInfo >= pmLen) {
- if (VBE_shared)
- PM_freeShared(state->pmInfo);
- else
- PM_free(state->pmInfo);
- state->pmInfo32 = state->pmInfo = NULL;
- return;
- }
-
- /* Read the IO priveledge info and determine if we need to
- * pass a selector to MMIO registers to the bank switch code.
- * Since we no longer support selector allocation, we no longer
- * support this mechanism so we disable the protected mode
- * interface in this case.
- */
- if (state->pmInfo->IOPrivInfo && !state->MMIOSel) {
- ushort *p = (ushort*)((uchar*)state->pmInfo + state->pmInfo->IOPrivInfo);
- while (*p != 0xFFFF)
- p++;
- p++;
- if (*p != 0xFFFF)
- VBE_freePMCode();
- }
- }
+ regs.x.ax = 0x4F0A;
+ regs.x.bx = 0;
+ PM_int86x(0x10,&regs,&regs,&sregs);
+ if (regs.x.ax != VBE_SUCCESS)
+ return;
+ if (VBE_shared)
+ state->pmInfo = PM_mallocShared(regs.x.cx);
+ else
+ state->pmInfo = PM_malloc(regs.x.cx);
+ if (state->pmInfo == NULL)
+ return;
+ state->pmInfo32 = state->pmInfo;
+ pmLen = regs.x.cx;
+
+ /* Relocate the block into our local data segment */
+ code = PM_mapRealPointer(sregs.es,regs.x.di);
+ memcpy(state->pmInfo,code,pmLen);
+
+ /* Now do a sanity check on the information we recieve to ensure
+ * that is is correct. Some BIOS return totally bogus information
+ * in here (Matrox is one)! Under DOS this works OK, but under OS/2
+ * we are screwed.
+ */
+ if (state->pmInfo->setWindow >= pmLen ||
+ state->pmInfo->setDisplayStart >= pmLen ||
+ state->pmInfo->setPalette >= pmLen ||
+ state->pmInfo->IOPrivInfo >= pmLen) {
+ if (VBE_shared)
+ PM_freeShared(state->pmInfo);
+ else
+ PM_free(state->pmInfo);
+ state->pmInfo32 = state->pmInfo = NULL;
+ return;
+ }
+
+ /* Read the IO priveledge info and determine if we need to
+ * pass a selector to MMIO registers to the bank switch code.
+ * Since we no longer support selector allocation, we no longer
+ * support this mechanism so we disable the protected mode
+ * interface in this case.
+ */
+ if (state->pmInfo->IOPrivInfo && !state->MMIOSel) {
+ ushort *p = (ushort*)((uchar*)state->pmInfo + state->pmInfo->IOPrivInfo);
+ while (*p != 0xFFFF)
+ p++;
+ p++;
+ if (*p != 0xFFFF)
+ VBE_freePMCode();
+ }
+ }
}
void * VBEAPI VBE_getSetBank(void)
@@ -1050,10 +1050,10 @@ void * VBEAPI VBE_getSetBank(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setWindow;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setWindow;
+ }
return NULL;
}
@@ -1066,10 +1066,10 @@ void * VBEAPI VBE_getSetDisplayStart(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setDisplayStart;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setDisplayStart;
+ }
return NULL;
}
@@ -1082,10 +1082,10 @@ void * VBEAPI VBE_getSetPalette(void)
****************************************************************************/
{
if (state->VBEVersion >= 0x200) {
- InitPMCode();
- if (state->pmInfo)
- return (uchar*)state->pmInfo + state->pmInfo->setPalette;
- }
+ InitPMCode();
+ if (state->pmInfo)
+ return (uchar*)state->pmInfo + state->pmInfo->setPalette;
+ }
return NULL;
}
@@ -1104,13 +1104,13 @@ void VBEAPI VBE_freePMCode(void)
****************************************************************************/
{
if (state->pmInfo) {
- if (VBE_shared)
- PM_freeShared(state->pmInfo);
- else
- PM_free(state->pmInfo);
- state->pmInfo = NULL;
- state->pmInfo32 = NULL;
- }
+ if (VBE_shared)
+ PM_freeShared(state->pmInfo);
+ else
+ PM_free(state->pmInfo);
+ state->pmInfo = NULL;
+ state->pmInfo32 = NULL;
+ }
}
void VBEAPI VBE_sharePMCode(void)
@@ -1183,31 +1183,31 @@ ibool VBEAPI VBE_getBankFunc32(int *codeLen,void **bankFunc,int dualBanks,
InitPMCode();
if (state->VBEVersion >= 0x200 && state->pmInfo32 && !state->MMIOSel) {
- code = (uchar*)state->pmInfo32 + state->pmInfo32->setWindow;
- if (state->pmInfo32->extensionSig == VBE20_EXT_SIG)
- len = state->pmInfo32->setWindowLen-1;
- else {
- /* We are running on a system without the UniVBE 5.2 extension.
- * We do as best we can by scanning through the code for the
- * ret function to determine the length. This is not foolproof,
- * but is the best we can do.
- */
- p = code;
- while (*p != 0xC3)
- p++;
- len = p - code;
- }
- if ((len + sizeof(VBE20A_bankFunc32_Start) + sizeof(VBE20_bankFunc32_End)) > sizeof(bankFunc32))
- PM_fatalError("32-bit bank switch function too long!");
- copy(p,bankFunc32,VBE20A_bankFunc32_Start);
- memcpy(p,code,len);
- p += len;
- copy(p,p,VBE20_bankFunc32_End);
- *codeLen = p - bankFunc32;
- bankFunc32[VBE20_adjustOffset] = (uchar)bankAdjust;
- *bankFunc = bankFunc32;
- return true;
- }
+ code = (uchar*)state->pmInfo32 + state->pmInfo32->setWindow;
+ if (state->pmInfo32->extensionSig == VBE20_EXT_SIG)
+ len = state->pmInfo32->setWindowLen-1;
+ else {
+ /* We are running on a system without the UniVBE 5.2 extension.
+ * We do as best we can by scanning through the code for the
+ * ret function to determine the length. This is not foolproof,
+ * but is the best we can do.
+ */
+ p = code;
+ while (*p != 0xC3)
+ p++;
+ len = p - code;
+ }
+ if ((len + sizeof(VBE20A_bankFunc32_Start) + sizeof(VBE20_bankFunc32_End)) > sizeof(bankFunc32))
+ PM_fatalError("32-bit bank switch function too long!");
+ copy(p,bankFunc32,VBE20A_bankFunc32_Start);
+ memcpy(p,code,len);
+ p += len;
+ copy(p,p,VBE20_bankFunc32_End);
+ *codeLen = p - bankFunc32;
+ bankFunc32[VBE20_adjustOffset] = (uchar)bankAdjust;
+ *bankFunc = bankFunc32;
+ return true;
+ }
return false;
}
OpenPOWER on IntegriCloud