From 121a93307397a5bd4b1847b477fa74d40a19bc13 Mon Sep 17 00:00:00 2001 From: Chris Apers Date: Sun, 26 Feb 2006 16:59:28 +0000 Subject: New files including moved getFeatures and VG helper svn-id: r20934 --- backends/PalmOS/Src/init_stuffs.cpp | 130 ++++++++++++++++++++++++++++++++++++ backends/PalmOS/Src/init_stuffs.h | 11 +++ 2 files changed, 141 insertions(+) create mode 100755 backends/PalmOS/Src/init_stuffs.cpp create mode 100755 backends/PalmOS/Src/init_stuffs.h (limited to 'backends/PalmOS') diff --git a/backends/PalmOS/Src/init_stuffs.cpp b/backends/PalmOS/Src/init_stuffs.cpp new file mode 100755 index 0000000000..3b2ab9c869 --- /dev/null +++ b/backends/PalmOS/Src/init_stuffs.cpp @@ -0,0 +1,130 @@ +#include +#include +#include +#include +#include +#include + +#include "globals.h" // for OPTIONS_DEF() +#include "init_stuffs.h" +#include "stuffs.h" + +#ifndef DISABLE_TAPWAVE +#define __TWKEYS_H__ // bad hack +#include "tapwave.h" +#endif + +#ifndef DISABLE_PA1LIB +#include "Pa1Lib.h" +#endif + +#ifndef DISABLE_LIGHTSPEED +#include "lightspeed_public.h" +#endif + +// TODO : check the depth to set correct value +// works only for 8bit for now +UInt32 StuffsGetPitch(Coord fullw) { + UInt32 pitch = 0; + + if (OPTIONS_TST(kOptModeHiDensity)) { + WinScreenGetAttribute(winScreenRowBytes, &pitch); + + // FIXME : hack for TT3 simulator (and real ?) return 28 on landscape mode + if (pitch < fullw) + pitch = fullw; + + } else { + pitch = fullw; + } + + return pitch; +} + +void *StuffsForceVG() { + // create an empty form to force the VG to be shown + FormType *frmP = FrmNewForm(4567, NULL, 0,0,0,0, false, 0, 0, 0); + FrmDrawForm(frmP); + return frmP; +} + +void StuffsReleaseVG(void *vg) { + FrmDeleteForm((FormPtr)vg); +} + +void StuffsGetFeatures() { + UInt32 ulProcessorType, manufacturer, version, depth; + Boolean color; + +#ifndef DISABLE_TAPWAVE + // Tapwave Zodiac libs ? + if (!FtrGet(sysFileCSystem, sysFtrNumOEMCompanyID, &manufacturer)) + if (manufacturer == twCreatorID) { + OPTIONS_SET(kOptDeviceZodiac); + OPTIONS_SET(kOpt5WayNavigatorV2); + } +#endif + + // Hi-Density present ? + if (!FtrGet(sysFtrCreator, sysFtrNumWinVersion, &version)) + if (version >= 4) + OPTIONS_SET(kOptModeHiDensity); + + // OS5 ? + if (!FtrGet(sysFtrCreator, sysFtrNumROMVersion, &version)) + if (version >= kOS5Version) + OPTIONS_SET(kOptDeviceOS5); + + // ARM ? + if (!FtrGet(sysFileCSystem, sysFtrNumProcessorID, &ulProcessorType)) + if (sysFtrNumProcessorIsARM(ulProcessorType)) + OPTIONS_SET(kOptDeviceARM); + else if (ulProcessorType == sysFtrNumProcessorx86) + OPTIONS_SET(kOptDeviceProcX86); + + // 5Way Navigator + if (!FtrGet(hsFtrCreator, hsFtrIDNavigationSupported, &version)) { + if (version >= 2) + OPTIONS_SET(kOpt5WayNavigatorV2); + + } else if (!FtrGet(sysFtrCreator, sysFtrNumFiveWayNavVersion, &version)) { + if (version >= 2) + OPTIONS_SET(kOpt5WayNavigatorV2); + else + OPTIONS_SET(kOpt5WayNavigatorV1); + + } else if (!FtrGet(navFtrCreator, navFtrVersion, &version)) { + if (version >= 2) + OPTIONS_SET(kOpt5WayNavigatorV2); + else + OPTIONS_SET(kOpt5WayNavigatorV1); + } + + // Palm Sound API ? + if (!FtrGet(sysFileCSoundMgr, sndFtrIDVersion, &version)) + if (version >= 1) + OPTIONS_SET(kOptPalmSoundAPI); + +#ifndef DISABLE_PA1LIB + // Sony Pa1 Sound API + if (Pa1Lib_Open()) { + OPTIONS_SET(kOptSonyPa1LibAPI); + Pa1Lib_Close(); + } +#endif + + // GoLCD + if (!FtrGet(goLcdLibCreator, goLcdLibFtrNum, &version)) + OPTIONS_SET(kOptGoLcdAPI); + +#ifndef DISABLE_LIGHTSPEED + // Lightspeed + if (LS_Installed()) + OPTIONS_SET(kOptLightspeedAPI); +#endif + + // check for 16bit mode + if (!WinScreenMode(winScreenModeGetSupportedDepths, NULL, NULL, &depth, &color)) + OPTIONS_SET(((depth & 0x8000) ? kOptMode16Bit : kOptNone)); + +} \ No newline at end of file diff --git a/backends/PalmOS/Src/init_stuffs.h b/backends/PalmOS/Src/init_stuffs.h new file mode 100755 index 0000000000..124510eeac --- /dev/null +++ b/backends/PalmOS/Src/init_stuffs.h @@ -0,0 +1,11 @@ +#ifndef INIT_STUFFS_H +#define INIT_STUFFS_H + +#define kOS5Version sysMakeROMVersion(5,0,0,sysROMStageRelease,0) + +void StuffsGetFeatures(); +UInt32 StuffsGetPitch(Coord fullw); +void *StuffsForceVG(); +void StuffsReleaseVG(void *vg); + +#endif -- cgit v1.2.3