mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 13:50:13 +00:00
started to merge in Chrilith's PalmOS port
svn-id: r7219
This commit is contained in:
parent
79ebda7613
commit
42f156ddad
BIN
backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
Normal file
BIN
backends/PalmOS/Rsc/Resource.Frk/Starter.rsrc
Normal file
Binary file not shown.
After Width: | Height: | Size: 20 KiB |
0
backends/PalmOS/Rsc/Starter.rsrc
Normal file
0
backends/PalmOS/Rsc/Starter.rsrc
Normal file
233
backends/PalmOS/Rsc/StarterRsc.h
Normal file
233
backends/PalmOS/Rsc/StarterRsc.h
Normal file
@ -0,0 +1,233 @@
|
||||
// Header generated by Constructor for Palm OS (R) 1.9
|
||||
//
|
||||
// Generated at 16:39:35 on vendredi 25 avril 2003
|
||||
//
|
||||
// Generated for file: Starter.rsrc
|
||||
//
|
||||
// THIS IS AN AUTOMATICALLY GENERATED HEADER FILE
|
||||
// DO NOT EDIT - CHANGES MADE TO THIS FILE WILL BE LOST
|
||||
//
|
||||
// Palm App Name: "ScummVM"
|
||||
//
|
||||
// Palm App Version: "1.0"
|
||||
|
||||
|
||||
// Resource: tFRM 1000
|
||||
#define MainForm 1000 //(Left Origin = 0, Top Origin = 0, Width = 160, Height = 160, Usable = 1, Modal = 0, Save Behind = 0, Help ID = 0, Menu Bar ID = 1000, Default Button ID = 0)
|
||||
#define MainCardsButton 1003 //(Left Origin = 135, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 0, Font = Standard)
|
||||
#define MainAboutButton 1012 //(Left Origin = 148, Top Origin = 1, Width = 12, Height = 12, Usable = 1, Anchor Left = 1, Frame = 0, Non-bold Frame = 1, Font = Standard)
|
||||
#define MainMSBitMap 1100 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1100, Usable = 0)
|
||||
#define MainMSNoneBitMap 1110 //(Left Origin = 135, Top Origin = 1, Bitmap Resource ID = 1110, Usable = 0)
|
||||
#define MainUnnamed1010BitMap 2000 //(Left Origin = 148, Top Origin = 1, Bitmap Resource ID = 2000, Usable = 1)
|
||||
|
||||
// Resource: tFRM 1100
|
||||
#define AboutForm 1100 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
#define AboutOKButton 1105 //(Left Origin = 121, Top Origin = 139, Width = 30, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define AboutUnnamed1108BitMap 1000 //(Left Origin = 69, Top Origin = 15, Bitmap Resource ID = 1000, Usable = 1)
|
||||
#define AboutUnnamed1102Label 1102 //(Left Origin = 34, Top Origin = 49, Usable = 1, Font = Standard)
|
||||
#define AboutUnnamed1103Label 1103 //(Left Origin = 38, Top Origin = 67, Usable = 1, Font = Bold)
|
||||
#define AboutUnnamed1104Label 1104 //(Left Origin = 9, Top Origin = 106, Usable = 1, Font = Bold)
|
||||
#define AboutUnnamed1106Label 1106 //(Left Origin = 18, Top Origin = 116, Usable = 1, Font = Standard)
|
||||
#define AboutVersionLabel 1107 //(Left Origin = 4, Top Origin = 139, Usable = 1, Font = Standard)
|
||||
#define AboutUnnamed1109Label 1109 //(Left Origin = 54, Top Origin = 77, Usable = 1, Font = Standard)
|
||||
#define AboutUnnamed1110Label 1110 //(Left Origin = 8, Top Origin = 87, Usable = 1, Font = Standard)
|
||||
#define AboutUnnamed1111Label 1111 //(Left Origin = 26, Top Origin = 39, Usable = 1, Font = Standard)
|
||||
|
||||
// Resource: tFRM 1300
|
||||
#define HelpForm 1300 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
|
||||
// Resource: tFRM 1200
|
||||
#define SkinsForm 1200 //(Left Origin = 2, Top Origin = 63, Width = 156, Height = 95, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1203)
|
||||
#define SkinsOKButton 1202 //(Left Origin = 5, Top Origin = 78, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SkinsCancelButton 1203 //(Left Origin = 43, Top Origin = 78, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SkinsSkinDeleteButton 1204 //(Left Origin = 115, Top Origin = 78, Width = 36, Height = 12, Usable = 0, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SkinsDeleteButton 1205 //(Left Origin = 119, Top Origin = 78, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SkinsBeamButton 1206 //(Left Origin = 81, Top Origin = 78, Width = 32, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SkinsSkinList 1201 //(Left Origin = 5, Top Origin = 17, Width = 146, Usable = 1, Font = Standard, Visible Items = 5)
|
||||
|
||||
// Resource: tFRM 1400
|
||||
#define EditGameForm 1400 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 1411)
|
||||
#define EditGameOKButton 1410 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define EditGameCancelButton 1411 //(Left Origin = 46, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define EditGameDeleteButton 1412 //(Left Origin = 115, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define EditGameLoadSlotCheckbox 1413 //(Left Origin = 4, Top Origin = 85, Width = 85, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define EditGameStartRoomCheckbox 1414 //(Left Origin = 4, Top Origin = 97, Width = 84, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define EditGameAmigaCheckbox 1417 //(Left Origin = 4, Top Origin = 109, Width = 81, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define EditGameSubtitlesCheckbox 1418 //(Left Origin = 4, Top Origin = 121, Width = 68, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define EditGameTalkSpeedCheckbox 1421 //(Left Origin = 4, Top Origin = 73, Width = 66, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define EditGameEntryNameField 1402 //(Left Origin = 4, Top Origin = 28, Width = 148, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 50, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0)
|
||||
#define EditGamePathField 1404 //(Left Origin = 34, Top Origin = 42, Width = 118, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 150, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0)
|
||||
#define EditGameGameField 1406 //(Left Origin = 34, Top Origin = 56, Width = 60, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 10, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0)
|
||||
#define EditGameLoadSlotField 1415 //(Left Origin = 92, Top Origin = 85, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 2, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1)
|
||||
#define EditGameStartRoomField 1416 //(Left Origin = 92, Top Origin = 97, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 4, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1)
|
||||
#define EditGameTalkSpeedField 1423 //(Left Origin = 92, Top Origin = 73, Width = 18, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 3, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1)
|
||||
#define EditGameUnnamed1407GraffitiShift 1407 //(Left Origin = 87, Top Origin = 140)
|
||||
#define EditGameUnnamed1401Label 1401 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold)
|
||||
#define EditGameUnnamed1403Label 1403 //(Left Origin = 9, Top Origin = 42, Usable = 1, Font = Standard)
|
||||
#define EditGameUnnamed1405Label 1405 //(Left Origin = 4, Top Origin = 56, Usable = 1, Font = Standard)
|
||||
#define EditGameUnnamed1419Label 1419 //(Left Origin = 88, Top Origin = 85, Usable = 1, Font = Standard)
|
||||
#define EditGameUnnamed1420Label 1420 //(Left Origin = 88, Top Origin = 97, Usable = 1, Font = Standard)
|
||||
#define EditGameUnnamed1422Label 1422 //(Left Origin = 88, Top Origin = 73, Usable = 1, Font = Standard)
|
||||
#define EditGameGfxListList 1409 //(Left Origin = 95, Top Origin = 56, Width = 55, Usable = 0, Font = Standard, Visible Items = 3)
|
||||
#define EditGameGfxPopupPopTrigger 1408 //(Left Origin = 99, Top Origin = 56, Width = 53, Height = 12, Usable = 1, Anchor Left = 0, Font = Standard, List ID = 1409)
|
||||
|
||||
// Resource: tFRM 1500
|
||||
#define CardSlotForm 1500 //(Left Origin = 30, Top Origin = 42, Width = 100, Height = 75, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
#define CardSlotOkButton 1501 //(Left Origin = 31, Top Origin = 58, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define CardSlotSlotList 1502 //(Left Origin = 5, Top Origin = 17, Width = 90, Usable = 1, Font = Standard, Visible Items = 3)
|
||||
|
||||
// Resource: tFRM 1600
|
||||
#define MiscOptionsForm 1600 //(Left Origin = 2, Top Origin = 28, Width = 156, Height = 130, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
#define MiscOptionsOKButton 1608 //(Left Origin = 5, Top Origin = 113, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define MiscOptionsCancelButton 1609 //(Left Origin = 46, Top Origin = 113, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define MiscOptionsVibratorCheckbox 1602 //(Left Origin = 4, Top Origin = 28, Width = 128, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define MiscOptionsNoAutoOffCheckbox 1603 //(Left Origin = 4, Top Origin = 40, Width = 152, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define MiscOptionsStdPaletteCheckbox 1604 //(Left Origin = 4, Top Origin = 52, Width = 146, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define MiscOptionsDebugCheckbox 1606 //(Left Origin = 4, Top Origin = 86, Width = 100, Height = 12, Usable = 1, Selected = 0, Group ID = 0, Font = Standard)
|
||||
#define MiscOptionsDebugLevelField 1607 //(Left Origin = 103, Top Origin = 86, Width = 12, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 1, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 1)
|
||||
#define MiscOptionsUnnamed1601Label 1601 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold)
|
||||
#define MiscOptionsUnnamed1605Label 1605 //(Left Origin = 4, Top Origin = 74, Usable = 1, Font = Bold)
|
||||
|
||||
// Resource: tFRM 1700
|
||||
#define VolumeForm 1700 //(Left Origin = 2, Top Origin = 2, Width = 156, Height = 156, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
#define VolumeOKButton 1701 //(Left Origin = 5, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define VolumeCancelButton 1702 //(Left Origin = 47, Top Origin = 139, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define VolumeUnnamed1704Label 1704 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold)
|
||||
#define VolumeUnnamed1705Label 1705 //(Left Origin = 6, Top Origin = 46, Usable = 1, Font = Standard)
|
||||
#define VolumeUnnamed1709Label 1709 //(Left Origin = 18, Top Origin = 31, Usable = 1, Font = Standard)
|
||||
#define VolumeUnnamed1710Label 1710 //(Left Origin = 3, Top Origin = 68, Usable = 1, Font = Bold)
|
||||
#define VolumeUnnamed1712Label 1712 //(Left Origin = 21, Top Origin = 83, Usable = 1, Font = Standard)
|
||||
#define VolumeUnnamed1713Label 1713 //(Left Origin = 28, Top Origin = 98, Usable = 1, Font = Standard)
|
||||
#define VolumeUnnamed1714Label 1714 //(Left Origin = 14, Top Origin = 113, Usable = 1, Font = Standard)
|
||||
#define VolumeSpeakerSliderControl 1703 //(Left Origin = 60, Top Origin = 28, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 31, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0)
|
||||
#define VolumeHeadphoneSliderControl 1706 //(Left Origin = 60, Top Origin = 43, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 31, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0)
|
||||
#define VolumeMasterSliderControl 1707 //(Left Origin = 60, Top Origin = 80, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0)
|
||||
#define VolumeMusicSliderControl 1708 //(Left Origin = 60, Top Origin = 95, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0)
|
||||
#define VolumeSfxSliderControl 1711 //(Left Origin = 60, Top Origin = 110, Width = 93, Height = 15, Usable = 1, Initial Value = 0, Minimum Value = 0, Maximum Value = 255, Page Jump Amount = 1, Thumb Bitmap = 0, Background Bitmap = 0)
|
||||
|
||||
// Resource: tFRM 1800
|
||||
#define SoundForm 1800 //(Left Origin = 2, Top Origin = 34, Width = 156, Height = 124, Usable = 1, Modal = 1, Save Behind = 1, Help ID = 0, Menu Bar ID = 0, Default Button ID = 0)
|
||||
#define SoundOKButton 1809 //(Left Origin = 5, Top Origin = 106, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SoundCancelButton 1810 //(Left Origin = 47, Top Origin = 106, Width = 36, Height = 12, Usable = 1, Anchor Left = 1, Frame = 1, Non-bold Frame = 1, Font = Standard)
|
||||
#define SoundMusicCheckbox 1801 //(Left Origin = 4, Top Origin = 28, Width = 79, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard)
|
||||
#define SoundSfxCheckbox 1802 //(Left Origin = 4, Top Origin = 82, Width = 106, Height = 12, Usable = 1, Selected = 1, Group ID = 0, Font = Standard)
|
||||
#define SoundTempoField 1808 //(Left Origin = 64, Top Origin = 52, Width = 50, Height = 12, Usable = 1, Editable = 1, Underline = 1, Single Line = 1, Dynamic Size = 0, Left Justified = 1, Max Characters = 8, Font = Standard, Auto Shift = 0, Has Scroll Bar = 0, Numeric = 0)
|
||||
#define SoundUnnamed1803Label 1803 //(Left Origin = 4, Top Origin = 16, Usable = 1, Font = Bold)
|
||||
#define SoundUnnamed1804Label 1804 //(Left Origin = 21, Top Origin = 40, Usable = 1, Font = Standard)
|
||||
#define SoundUnnamed1806Label 1806 //(Left Origin = 18, Top Origin = 52, Usable = 1, Font = Standard)
|
||||
#define SoundUnnamed1807Label 1807 //(Left Origin = 4, Top Origin = 70, Usable = 1, Font = Bold)
|
||||
#define SoundDriverList 1811 //(Left Origin = 54, Top Origin = 40, Width = 70, Usable = 0, Font = Standard, Visible Items = 2)
|
||||
#define SoundDriverPopTrigger 1805 //(Left Origin = 54, Top Origin = 40, Width = 73, Height = 14, Usable = 1, Anchor Left = 1, Font = Standard, List ID = 1811)
|
||||
|
||||
|
||||
// Resource: Talt 1001
|
||||
#define RomIncompatibleAlert 1001
|
||||
#define RomIncompatibleOK 0
|
||||
|
||||
// Resource: Talt 1000
|
||||
#define FrmWarnAlert 1000
|
||||
#define FrmWarnOK 0
|
||||
|
||||
// Resource: Talt 1100
|
||||
#define FrmErrorAlert 1100
|
||||
#define FrmErrorCancel 0
|
||||
|
||||
// Resource: Talt 1200
|
||||
#define FrmFatalErrorAlert 1200
|
||||
#define FrmFatalErrorReset 0
|
||||
|
||||
// Resource: Talt 1300
|
||||
#define FrmDeleteAlert 1300
|
||||
#define FrmDeleteYes 0
|
||||
#define FrmDeleteNo 1
|
||||
|
||||
// Resource: Talt 1400
|
||||
#define FrmInfoAlert 1400
|
||||
#define FrmInfoOK 0
|
||||
|
||||
|
||||
// Resource: MBAR 1000
|
||||
#define MainFormMenuBar 1000
|
||||
|
||||
|
||||
// Resource: MENU 1000
|
||||
#define MainOptionsMenu 1000
|
||||
#define MainOptionsVolumeControl 1000 // Command Key: V
|
||||
#define MainOptionsSoundPrefs 1001 // Command Key: S
|
||||
#define MainOptionsSkins 1003 // Command Key: K
|
||||
#define MainOptionsMiscellaneous 1004 // Command Key: M
|
||||
#define MainOptionsAbout 1006
|
||||
|
||||
// Resource: MENU 1100
|
||||
#define MainGamesMenu 1100
|
||||
#define MainGamesNewEdit 1100 // Command Key: E
|
||||
#define MainGamesBeamScummVM 1101 // Command Key: B
|
||||
#define MainGamesChooseaCard 1103 // Command Key: C
|
||||
|
||||
|
||||
// Resource: tSTR 9991
|
||||
#define ClieCatString 9991 // "32779"
|
||||
|
||||
// Resource: tSTR 9990
|
||||
#define ClieDescString 9990 // "Play your favorite LucasArts games"
|
||||
|
||||
|
||||
// Resource: PICT 1001
|
||||
#define Bitmap 1001
|
||||
|
||||
// Resource: PICT 1002
|
||||
#define Bitmap2 1002
|
||||
|
||||
// Resource: PICT 1008
|
||||
#define Bitmap3 1008
|
||||
|
||||
// Resource: PICT 1011
|
||||
#define Bitmap4 1011
|
||||
|
||||
// Resource: PICT 1012
|
||||
#define Bitmap5 1012
|
||||
|
||||
// Resource: PICT 1018
|
||||
#define Bitmap6 1018
|
||||
|
||||
// Resource: PICT 2000
|
||||
#define infoBitmap 2000
|
||||
|
||||
// Resource: PICT 1100
|
||||
#define msOnBitmap 1100
|
||||
|
||||
// Resource: PICT 1009
|
||||
#define Bitmap7 1009
|
||||
|
||||
// Resource: PICT 1010
|
||||
#define Bitmap8 1010
|
||||
|
||||
// Resource: PICT 1110
|
||||
#define msNoneBitmap 1110
|
||||
|
||||
// Resource: PICT 3000
|
||||
#define ctrlKeyBitmap 3000
|
||||
|
||||
// Resource: PICT 3001
|
||||
#define altKeyBitmap 3001
|
||||
|
||||
|
||||
// Resource: tbmf 1000
|
||||
#define Icon_infoBitmapFamily 1000
|
||||
|
||||
// Resource: tbmf 1100
|
||||
#define MsOnBitmapFamily 1100
|
||||
|
||||
// Resource: tbmf 2000
|
||||
#define InfoBitmapFamily 2000
|
||||
|
||||
// Resource: tbmf 1110
|
||||
#define MsNoneBitmapFamily 1110
|
||||
|
||||
|
||||
// Resource: taif 1000
|
||||
#define Largeicons12and8bitsAppIconFamily 1000
|
||||
|
||||
// Resource: taif 1001
|
||||
#define Smallicons12and8bitsAppIconFamily 1001
|
||||
|
89
backends/PalmOS/Src/extend.cpp
Normal file
89
backends/PalmOS/Src/extend.cpp
Normal file
@ -0,0 +1,89 @@
|
||||
#include <PalmOS.h>
|
||||
#include "extend.h"
|
||||
#include "string.h"
|
||||
#include "palm.h"
|
||||
/*
|
||||
//Sony clie PalmOS<5
|
||||
void BmpDrawDDBitmap(const FormType *formP, DmResID bitmapID)
|
||||
{
|
||||
MemHandle hTemp;
|
||||
BitmapType* bmTemp;
|
||||
Coord x,y;
|
||||
|
||||
hTemp = DmGetResource(bitmapRsc,bitmapID);
|
||||
bmTemp = (BitmapType*)MemHandleLock(hTemp);
|
||||
|
||||
FrmGetObjectPosition(formP, FrmGetObjectIndex(formP,bitmapID), &x, &y);
|
||||
HRWinDrawBitmap(gHRrefNum,bmTemp, x*2, y*2);
|
||||
|
||||
MemHandleUnlock(hTemp);
|
||||
DmReleaseResource(hTemp);
|
||||
// palmos 5 : need to set the object to usable
|
||||
}
|
||||
*/
|
||||
UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr)
|
||||
{
|
||||
Char *found;
|
||||
Boolean quit = false;
|
||||
UInt16 occurences = 0;
|
||||
UInt16 newLength;
|
||||
UInt16 l1 = StrLen(fndParamStr);
|
||||
UInt16 l2 = 0;
|
||||
UInt16 l3 = StrLen(ioStr);
|
||||
UInt16 next = 0;
|
||||
|
||||
if (inParamStr)
|
||||
l2 = StrLen(inParamStr); // can be null to know how many occur.
|
||||
|
||||
while (((found = StrStr(ioStr+next, fndParamStr)) != NULL) && (!quit))
|
||||
{
|
||||
occurences++;
|
||||
newLength = (StrLen(ioStr) - l1 + l2);
|
||||
|
||||
if ( newLength > inMaxLen )
|
||||
{
|
||||
quit = true;
|
||||
occurences--;
|
||||
}
|
||||
else if (inParamStr)
|
||||
{
|
||||
MemMove(found + l2, found + l1, inMaxLen-(found-ioStr+l2));
|
||||
MemMove(found, inParamStr, l2);
|
||||
next = found - ioStr + l2;
|
||||
}
|
||||
else
|
||||
next = found - ioStr + l1;
|
||||
}
|
||||
|
||||
if (inParamStr)
|
||||
ioStr[l3 + l2*occurences - l1*occurences] = 0;
|
||||
|
||||
return occurences;
|
||||
}
|
||||
|
||||
void WinDrawWarpChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth)
|
||||
{
|
||||
Char *part = (Char *)chars;
|
||||
Coord x2 = x;
|
||||
Int16 next;
|
||||
|
||||
if (part[StrLen(part)-1] == '\n')
|
||||
part[StrLen(part)-1] = 0;
|
||||
|
||||
part = StrTok(part," ");
|
||||
|
||||
while ( part )
|
||||
{
|
||||
next = FntLineWidth (part, StrLen(part)) + FntLineWidth (" ",1);
|
||||
if ((x2 + next - x) > maxWidth)
|
||||
{
|
||||
x2 = x;
|
||||
y += FntLineHeight();
|
||||
}
|
||||
//HRWinDrawTruncChars(gHRrefNum, part, StrLen(part), x2, y, maxWidth - (x2-x));
|
||||
WinDrawTruncChars(part, StrLen(part), x2, y, maxWidth - (x2-x));
|
||||
x2 += next;
|
||||
|
||||
part = StrTok(NULL," ");
|
||||
}
|
||||
}
|
15
backends/PalmOS/Src/extend.h
Normal file
15
backends/PalmOS/Src/extend.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef EXTEND_H
|
||||
#define EXTEND_H
|
||||
|
||||
extern const Char *SCUMMVM_SAVEPATH; // extras.cpp
|
||||
|
||||
#define DISABLE_SKY
|
||||
#define DISABLE_SIMON
|
||||
|
||||
#define OutputDebugString PalmFatalError
|
||||
|
||||
void WinDrawWarpChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth);
|
||||
UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr);
|
||||
void PalmFatalError(const Char *err);
|
||||
|
||||
#endif
|
217
backends/PalmOS/Src/extras.cpp
Normal file
217
backends/PalmOS/Src/extras.cpp
Normal file
@ -0,0 +1,217 @@
|
||||
//##############################################################################
|
||||
#include "extras.h"
|
||||
#include "StarterRsc.h"
|
||||
#include "mathlib.h"
|
||||
#include "globals.h"
|
||||
//#include "palm.h"
|
||||
//##############################################################################
|
||||
//UInt16 gVolRefNum = 0;
|
||||
//UInt16 HRrefNum,SndRefNum;
|
||||
|
||||
//FileRef logfile;
|
||||
//Boolean _flipping = false;
|
||||
//Boolean _vibrator = false;
|
||||
//extern Boolean gFlipping;
|
||||
//extern FileRef gLogFile;
|
||||
//##############################################################################
|
||||
//##############################################################################
|
||||
void *memchr(const void *s, int c, UInt32 n)
|
||||
{
|
||||
UInt32 chr;
|
||||
for(chr = 0; chr < n;chr++,((UInt8 *)s)++)
|
||||
if ( *((UInt8 *)s) == c)
|
||||
return (void *)s;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
/*
|
||||
|
||||
UInt32 time(UInt32 *cur)
|
||||
{
|
||||
UInt32 secs = TimGetTicks();
|
||||
|
||||
if (cur != NULL)
|
||||
*cur = secs;
|
||||
|
||||
return secs;
|
||||
}
|
||||
*/
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
const Char *SCUMMVM_SAVEPATH = "/PALM/Programs/ScummVM/Saved/";
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Err SonySoundLib(UInt16 *refNumP)
|
||||
{
|
||||
SonySysFtrSysInfoP sonySysFtrSysInfoP;
|
||||
Err error = errNone;
|
||||
|
||||
if ((error = FtrGet(sonySysFtrCreator, sonySysFtrNumSysInfoP, (UInt32*)&sonySysFtrSysInfoP))) {
|
||||
/* Not CLIE: maybe not available */
|
||||
} else {
|
||||
if (sonySysFtrSysInfoP->libr & sonySysFtrSysInfoLibrFm) {
|
||||
/* Sound-Lib available */
|
||||
if ((error = SysLibFind(sonySysLibNameSound, refNumP))) {
|
||||
if (error == sysErrLibNotFound) {
|
||||
/* couldn't find lib */
|
||||
error = SysLibLoad( 'libr', sonySysFileCSoundLib, refNumP );
|
||||
}
|
||||
}
|
||||
|
||||
if ( error ) {
|
||||
/* Now we can use Sound-Lib */
|
||||
FrmCustomAlert(FrmWarnAlert,"Sound Lib not found.",0,0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!error)
|
||||
FrmCustomAlert(FrmWarnAlert,"Sound Lib ok",0,0);
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
//UInt8 _indicatorColorOn = 255;
|
||||
//UInt8 _indicatorColorOff = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
int getc(FILE *stream)
|
||||
{
|
||||
UInt8 c;
|
||||
DrawStatus(true);
|
||||
Err error = VFSFileRead(*stream, 1, &c, NULL);
|
||||
DrawStatus(false);
|
||||
|
||||
if (error == errNone || error == vfsErrFileEOF)
|
||||
return c;
|
||||
|
||||
#ifdef DEBUG
|
||||
switch (error)
|
||||
{
|
||||
case expErrNotOpen:
|
||||
FrmCustomAlert(FrmWarn,"expErrNotOpen",0,0);
|
||||
break;
|
||||
case vfsErrFileBadRef:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFileBadRef",0,0);
|
||||
break;
|
||||
case vfsErrFileEOF:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFileEOF",0,0);
|
||||
break;
|
||||
case vfsErrFilePermissionDenied:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFilePermissionDenied",0,0);
|
||||
break;
|
||||
case vfsErrIsADirectory:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrIsADirectory",0,0);
|
||||
break;
|
||||
case vfsErrNoFileSystem:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrNoFileSystem",0,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
/*
|
||||
static Char *enumSaveLoad = NULL;
|
||||
|
||||
|
||||
void doEnumSaveLoad(const Char* path, const Char* game)
|
||||
{
|
||||
if (enumSaveLoad)
|
||||
return;
|
||||
|
||||
FileRef fileRef;
|
||||
Err e = VFSFileOpen(gVars->volRefNum, path, vfsModeRead, &fileRef);
|
||||
|
||||
if (e != errNone)
|
||||
return;
|
||||
|
||||
UInt32 dirEntryIterator = vfsIteratorStart;
|
||||
Char file[32];
|
||||
FileInfoType info = {0, file, 32};
|
||||
UInt16 lenght;
|
||||
UInt32 oldSize = 0;
|
||||
UInt32 count = 0;
|
||||
|
||||
while (dirEntryIterator != vfsIteratorStop)
|
||||
{
|
||||
e = VFSDirEntryEnumerate (fileRef, &dirEntryIterator, &info);
|
||||
if (e != expErrEnumerationEmpty)
|
||||
{
|
||||
if (StrNCaselessCompare(game, info.nameP, StrLen(game)) == 0)
|
||||
{
|
||||
lenght = StrLen(info.nameP);
|
||||
if (!enumSaveLoad)
|
||||
enumSaveLoad = (Char *)MemPtrNew(lenght+1);
|
||||
else
|
||||
{
|
||||
oldSize = MemPtrSize(enumSaveLoad);
|
||||
enumSaveLoad = (Char *)realloc(enumSaveLoad, oldSize + StrLen(info.nameP)+1);
|
||||
}
|
||||
TxtGlueLowerStr(info.nameP,StrLen(info.nameP));
|
||||
StrCopy(enumSaveLoad+oldSize, info.nameP);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count == 0) { // if no files, create an empty list item to prevent ALL FILES EXIST
|
||||
enumSaveLoad = (Char *)MemPtrNew(1);
|
||||
enumSaveLoad[0] = 0;
|
||||
}
|
||||
// if (count > 20)
|
||||
// endEnumSaveLoad(); // too manu files
|
||||
}
|
||||
|
||||
void endEnumSaveLoad()
|
||||
{
|
||||
if (!enumSaveLoad)
|
||||
return;
|
||||
|
||||
MemPtrFree(enumSaveLoad);
|
||||
enumSaveLoad = NULL;
|
||||
}
|
||||
|
||||
Boolean fexists(const Char* filename)
|
||||
{
|
||||
if (!enumSaveLoad)
|
||||
return true;
|
||||
|
||||
Char *found;
|
||||
UInt32 search = 0;
|
||||
UInt32 size = MemPtrSize(enumSaveLoad);
|
||||
UInt32 length = StrLen(filename);
|
||||
|
||||
// Char find[256];
|
||||
// StrCopy(find,filename);
|
||||
TxtGlueLowerStr((Char *)filename,length);
|
||||
|
||||
while (search < size)
|
||||
{
|
||||
found = StrStr(filename, enumSaveLoad+search);
|
||||
if ( found && found == (filename+length-StrLen(enumSaveLoad+search)) )
|
||||
return true;
|
||||
|
||||
search += StrLen(enumSaveLoad+search)+1;
|
||||
}
|
||||
|
||||
return false;
|
||||
}*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
134
backends/PalmOS/Src/extras.h
Normal file
134
backends/PalmOS/Src/extras.h
Normal file
@ -0,0 +1,134 @@
|
||||
//##############################################################################
|
||||
#include <PalmOS.h>
|
||||
#include <PalmOSGlue.h>
|
||||
#include "SonyClie.h"
|
||||
#include "VFSMgr.h"
|
||||
#include "mathlib.h"
|
||||
#include "vibrate.h"
|
||||
|
||||
#include <stdarg.h>
|
||||
//##############################################################################
|
||||
//##############################################################################
|
||||
int main(int argc, char **argv);
|
||||
MemPtr realloc(MemPtr, UInt32);
|
||||
MemPtr calloc(UInt32, UInt32);
|
||||
void exit(int);
|
||||
|
||||
//UInt16 parseCards(Boolean forceDisplay);
|
||||
|
||||
Err CheckMathLib();
|
||||
//Err CheckHRmode(void);
|
||||
Err SonySoundLib(UInt16 *refNumP);
|
||||
UInt16 StrReplace(Char *ioStr, UInt16 inMaxLen, const Char *inParamStr, const Char *fndParamStr);
|
||||
Int16 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam);
|
||||
Int16 sprintf(Char* s, const Char* formatStr, ...);
|
||||
Int16 printf(const Char* formatStr, ...);
|
||||
//void xsprintf(const Char* formatStr, ...);
|
||||
void PalmFatalError(const Char *err);
|
||||
|
||||
typedef FileRef FILE;
|
||||
UInt16 FindFileSlot();
|
||||
FILE *fopen(const char *filename, const char *type);
|
||||
UInt16 fprintf(FILE *stream, const Char *format, ...);
|
||||
int feof(FILE *stream);
|
||||
void clearerr(FILE *stream);
|
||||
UInt32 fread(void *ptr, UInt32 size, UInt32 nitems, FILE *stream);
|
||||
int fseek(FILE *stream, long offset, int whence);
|
||||
int fclose(FILE *stream);
|
||||
char *fgets(char *s, UInt32 n, FILE *stream);
|
||||
int free(MemPtr ptr);
|
||||
UInt32 fwrite(void *ptr, UInt32 size, UInt32 nitems, FILE *stream);
|
||||
int ftell(FILE *stream);
|
||||
//int getc(FILE *stream);
|
||||
|
||||
void *memchr(const void *s, int c, UInt32 n);
|
||||
Char *StrTok(Char *str, const Char *sep);
|
||||
void WinDrawWarpChars(const Char *chars, Int16 len, Coord x, Coord y, Coord maxWidth);
|
||||
|
||||
Err HwrDisplayPalette(UInt8 operation, Int16 startIndex,
|
||||
UInt16 paletteEntries, RGBColorType *tableP)
|
||||
SYS_TRAP(sysTrapHwrDisplayPalette);
|
||||
|
||||
//#define memNewChunkFlagNonMovable 0x0200
|
||||
#define memNewChunkFlagAllowLarge 0x1000 // this is not in the sdk *g*
|
||||
|
||||
|
||||
SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP)
|
||||
SYS_TRAP(sysTrapSysGetAppInfo);
|
||||
|
||||
//##############################################################################
|
||||
//#define DEBUG
|
||||
#define MAXPATHLEN 255
|
||||
#define NONSTANDARD_SAVE // scumm.h
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/*
|
||||
extern UInt16 firstCard;
|
||||
extern UInt16 HRrefNum;
|
||||
extern UInt16 SndRefNum;
|
||||
|
||||
extern FileRef logfile;
|
||||
extern Boolean _flipping;
|
||||
extern Boolean _vibrator;
|
||||
*/
|
||||
|
||||
//extern UInt8 *screen_1;
|
||||
//extern UInt8 *screen_2;
|
||||
|
||||
//extern Char **argvP;
|
||||
|
||||
//#define assert(a)
|
||||
//#define fflush(a)
|
||||
|
||||
//#define OutputDebugString PalmFatalError
|
||||
|
||||
//#define SEEK_SET vfsOriginBeginning
|
||||
//#define SEEK_CUR vfsOriginCurrent
|
||||
//#define SEEK_END vfsOriginEnd
|
||||
|
||||
//#define strtol(a,b,c) StrAToI(a)
|
||||
|
||||
//#define abs fabs
|
||||
/*
|
||||
//#define malloc MemPtrNew
|
||||
//#define calloc(a,b) MemPtrNew(((UInt32)a)*((UInt32)b))
|
||||
#define memcpy MemMove
|
||||
#define memmove MemMove
|
||||
//#define free MemPtrFree
|
||||
#define strcmp StrCompare
|
||||
#define strncmp StrNCompare
|
||||
#define stricmp StrCaselessCompare
|
||||
#define atoi StrAToI
|
||||
#define tolower TxtGlueLowerChar
|
||||
#define strchr StrChr
|
||||
#define strcat StrCat
|
||||
//#define vsprintf StrVPrintF
|
||||
//#define sprintf StrPrintF
|
||||
#define strtok StrTok
|
||||
#define rand() SysRandom(0)
|
||||
#define strncpy MemMove
|
||||
|
||||
|
||||
#define stdin 0
|
||||
#define stdout &logfile
|
||||
#define stderr &logfile
|
||||
|
||||
#define memset(ptr,value,numBytes) MemSet(ptr,numBytes,value)
|
||||
*/
|
||||
//typedef UInt32 time_t;
|
||||
//UInt32 time(UInt32 *cur);
|
||||
|
||||
#define bool Boolean
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned long uint32;
|
||||
// scumm protos
|
||||
///////////////
|
||||
struct AkosRenderer;
|
||||
// akos.cpp
|
||||
void akos_c1_0y_decode(AkosRenderer * ar);
|
||||
void akos_generic_decode(AkosRenderer * ar);
|
||||
void akos_c1_spec1(AkosRenderer * ar);
|
||||
// sound.cpp
|
||||
int CompDecode(unsigned char *src, unsigned char *dst);
|
||||
// simon.cpp
|
||||
void palette_fadeout(uint32 *pal_values,uint num);
|
||||
uint fileReadItemID(FILE *in);
|
35
backends/PalmOS/Src/globals.h
Normal file
35
backends/PalmOS/Src/globals.h
Normal file
@ -0,0 +1,35 @@
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
|
||||
typedef struct {
|
||||
DmOpenRef globals[3];
|
||||
|
||||
UInt16 HRrefNum;
|
||||
UInt16 volRefNum;
|
||||
FileRef logFile;
|
||||
|
||||
Boolean screenLocked;
|
||||
Boolean vibrator;
|
||||
Boolean stdPalette;
|
||||
/*
|
||||
struct {
|
||||
UInt16 speaker;
|
||||
UInt16 headphone;
|
||||
} volume;
|
||||
*/
|
||||
struct {
|
||||
UInt8 on;
|
||||
UInt8 off;
|
||||
} indicator;
|
||||
|
||||
struct {
|
||||
UInt8 *pageAddr1;
|
||||
UInt8 *pageAddr2;
|
||||
} flipping;
|
||||
|
||||
} GlobalsDataType;
|
||||
|
||||
extern GlobalsDataType *gVars;
|
||||
|
||||
|
||||
#endif
|
9
backends/PalmOS/Src/init.cpp
Normal file
9
backends/PalmOS/Src/init.cpp
Normal file
@ -0,0 +1,9 @@
|
||||
//#include <PalmOS.h>
|
||||
//#include "palm.h"
|
||||
//#include "starterrsc.h"
|
||||
|
||||
//UInt16 gHRrefNum = 0;
|
||||
//Boolean gVibrator = false;
|
||||
//Boolean gFlipping = false;
|
||||
//Boolean gScreenLocked = false;
|
||||
|
344
backends/PalmOS/Src/missing/_stdio.cpp
Normal file
344
backends/PalmOS/Src/missing/_stdio.cpp
Normal file
@ -0,0 +1,344 @@
|
||||
#include "stdio.h"
|
||||
#include "extend.h"
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//FileRef gLogFile;
|
||||
|
||||
static void DrawStatus(Boolean show)
|
||||
{
|
||||
UInt8 x,y;
|
||||
UInt8 *screen = (UInt8 *)(BmpGetBits(WinGetBitmap(WinGetDisplayWindow())));
|
||||
UInt8 color = (show? gVars->indicator.on : gVars->indicator.off);
|
||||
|
||||
if (gVars->screenLocked)
|
||||
if (screen == gVars->flipping.pageAddr1)
|
||||
screen = gVars->flipping.pageAddr2;
|
||||
else
|
||||
screen = gVars->flipping.pageAddr1;
|
||||
|
||||
screen += 320 + 305;
|
||||
for(y=0;y<3;y++)
|
||||
{
|
||||
for(x=0;x<14;x++)
|
||||
screen[x] = color;
|
||||
screen += 319;
|
||||
}
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt16 fclose(FileRef *stream)
|
||||
{
|
||||
Err error = VFSFileClose(*stream);
|
||||
|
||||
if (error == errNone)
|
||||
MemPtrFree(stream);
|
||||
|
||||
#ifdef DEBUG
|
||||
FrmCustomAlert(FrmWarnAlert,"error fclose",0,0);
|
||||
#endif
|
||||
return error;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt16 feof(FileRef *stream)
|
||||
{
|
||||
Err error = VFSFileEOF(*stream);
|
||||
|
||||
#ifdef DEBUG
|
||||
switch (error)
|
||||
{
|
||||
case vfsErrFileEOF:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFileEOF",0,0);
|
||||
break;
|
||||
case expErrNotOpen:
|
||||
FrmCustomAlert(FrmWarnAlert,"expErrNotOpen",0,0);
|
||||
break;
|
||||
case vfsErrFileBadRef:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFileBadRef",0,0);
|
||||
break;
|
||||
case vfsErrIsADirectory:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrIsADirectory",0,0);
|
||||
break;
|
||||
case vfsErrNoFileSystem:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrNoFileSystem",0,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return error;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Char *fgets(Char *s, UInt32 n, FileRef *stream)
|
||||
{
|
||||
UInt32 numBytesRead;
|
||||
DrawStatus(true);
|
||||
Err error = VFSFileRead(*stream, n, s, &numBytesRead);
|
||||
DrawStatus(false);
|
||||
if (error == errNone || error == vfsErrFileEOF) {
|
||||
UInt32 reset = 0;
|
||||
Char *endLine = StrChr(s, '\n');
|
||||
|
||||
if (endLine >= s) {
|
||||
reset = (endLine - s);
|
||||
s[reset] = 0;
|
||||
reset = numBytesRead - (reset + 1);
|
||||
VFSFileSeek(*stream, vfsOriginCurrent, -reset);
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
switch (error)
|
||||
{
|
||||
case expErrNotOpen:
|
||||
FrmCustomAlert(FrmWarnAlert,"expErrNotOpen",0,0);
|
||||
break;
|
||||
case vfsErrFileBadRef:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFileBadRef",0,0);
|
||||
break;
|
||||
case vfsErrFileEOF:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFileEOF",0,0);
|
||||
break;
|
||||
case vfsErrFilePermissionDenied:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFilePermissionDenied",0,0);
|
||||
break;
|
||||
case vfsErrIsADirectory:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrIsADirectory",0,0);
|
||||
break;
|
||||
case vfsErrNoFileSystem:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrNoFileSystem",0,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
FileRef *fopen(const Char *filename, const Char *type)
|
||||
{
|
||||
Err err;
|
||||
UInt16 openMode;
|
||||
FileRef *fileRefP = (FileRef *)MemPtrNew(sizeof(FileRef *));
|
||||
|
||||
if (StrCompare(type,"r")==0)
|
||||
openMode = vfsModeRead;
|
||||
else if (StrCompare(type,"rb")==0)
|
||||
openMode = vfsModeRead;
|
||||
else if (StrCompare(type,"w")==0)
|
||||
openMode = vfsModeCreate|vfsModeWrite;
|
||||
else if (StrCompare(type,"wb")==0)
|
||||
openMode = vfsModeCreate|vfsModeWrite;
|
||||
else
|
||||
openMode = vfsModeReadWrite;
|
||||
|
||||
if (openMode & vfsModeRead) {
|
||||
// if read file :
|
||||
// first try to load from the specfied card
|
||||
err = VFSFileOpen (gVars->volRefNum, filename, openMode, fileRefP);
|
||||
//if err (not found ?) parse each avalaible card for the specified file
|
||||
if (err) {
|
||||
UInt16 volRefNum;
|
||||
UInt32 volIterator = vfsIteratorStart;
|
||||
while (volIterator != vfsIteratorStop) {
|
||||
err = VFSVolumeEnumerate(&volRefNum, &volIterator);
|
||||
|
||||
if (!err) {
|
||||
err = VFSFileOpen (volRefNum, filename, openMode, fileRefP);
|
||||
if (!err)
|
||||
return fileRefP;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return fileRefP;
|
||||
}
|
||||
} else {
|
||||
// if write file :
|
||||
// use only the specified card
|
||||
// FIXME : vfsModeCreate|vfsModeWrite will failed on OS3.5 Clié
|
||||
err = VFSFileDelete(gVars->volRefNum, filename); // delete it if exists
|
||||
err = VFSFileCreate(gVars->volRefNum, filename);
|
||||
openMode = vfsModeWrite;
|
||||
if (!err) {
|
||||
err = VFSFileOpen (gVars->volRefNum, filename, openMode, fileRefP);
|
||||
if (!err)
|
||||
return fileRefP;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
else
|
||||
{
|
||||
switch (err)
|
||||
{
|
||||
case expErrCardReadOnly:
|
||||
FrmCustomAlert(FrmWarnAlert,"expErrCardReadOnly",0,0);
|
||||
break;
|
||||
case expErrNotOpen:
|
||||
FrmCustomAlert(FrmWarnAlert,"expErrNotOpen",0,0);
|
||||
break;
|
||||
case vfsErrBadName:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrBadName",0,0);
|
||||
break;
|
||||
case vfsErrFileNotFound:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFileNotFound",0,0);
|
||||
break;
|
||||
case vfsErrFilePermissionDenied:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrFilePermissionDenied",0,0);
|
||||
break;
|
||||
case vfsErrVolumeBadRef:
|
||||
FrmCustomAlert(FrmWarnAlert,"vfsErrVolumeBadRef",0,0);
|
||||
break;
|
||||
default:
|
||||
FrmCustomAlert(FrmWarnAlert,"unknow",0,0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
MemPtrFree(fileRefP); // prevent memory leak
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt32 fread(void *ptr, UInt32 size, UInt32 nitems, FileRef *stream)
|
||||
{
|
||||
UInt32 numBytesRead;
|
||||
DrawStatus(true);
|
||||
Err error = VFSFileRead(*stream, size*nitems, ptr, &numBytesRead);
|
||||
DrawStatus(false);
|
||||
if (error == errNone || error == vfsErrFileEOF)
|
||||
return (UInt32)(numBytesRead/size);
|
||||
|
||||
#ifdef DEBUG
|
||||
switch (error)
|
||||
{
|
||||
case expErrNotOpen:
|
||||
FrmCustomAlert(FrmWarn,"expErrNotOpen",0,0);
|
||||
break;
|
||||
case vfsErrFileBadRef:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFileBadRef",0,0);
|
||||
break;
|
||||
case vfsErrFileEOF:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFileEOF",0,0);
|
||||
break;
|
||||
case vfsErrFilePermissionDenied:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrFilePermissionDenied",0,0);
|
||||
break;
|
||||
case vfsErrIsADirectory:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrIsADirectory",0,0);
|
||||
break;
|
||||
case vfsErrNoFileSystem:
|
||||
FrmCustomAlert(FrmWarn,"vfsErrNoFileSystem",0,0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt32 fwrite(const void *ptr, UInt32 size, UInt32 nitems, FileRef *stream)
|
||||
{
|
||||
UInt32 numBytesWritten;
|
||||
DrawStatus(true);
|
||||
Err error = VFSFileWrite(*stream, size*nitems, ptr, &numBytesWritten);
|
||||
DrawStatus(false);
|
||||
|
||||
if (error == errNone || error == vfsErrFileEOF)
|
||||
return (UInt32)(numBytesWritten/size);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Int32 fseek(FileRef *stream, Int32 offset, Int32 whence)
|
||||
{
|
||||
Err error = VFSFileSeek(*stream, whence, offset);
|
||||
return error;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt32 ftell(FileRef *stream)
|
||||
{
|
||||
Err e;
|
||||
UInt32 filePos;
|
||||
|
||||
e = VFSFileTell(*stream,&filePos);
|
||||
if (e != errNone)
|
||||
return e;
|
||||
|
||||
return filePos;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
UInt16 fprintf(FileRef *stream, const Char *format, ...)
|
||||
{
|
||||
if (!*stream)
|
||||
return 0;
|
||||
|
||||
UInt32 numBytesWritten;
|
||||
Char buf[256];
|
||||
va_list va;
|
||||
|
||||
va_start(va, format);
|
||||
vsprintf(buf, format, va);
|
||||
va_end(va);
|
||||
|
||||
VFSFileWrite (*stream, StrLen(buf), buf, &numBytesWritten);
|
||||
return numBytesWritten;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Int16 printf(const Char *format, ...)
|
||||
{
|
||||
if (!*stdout)
|
||||
return 0;
|
||||
|
||||
UInt32 numBytesWritten;
|
||||
Char buf[256];
|
||||
// Char *buf = (Char *)MemPtrNew(256);
|
||||
va_list va;
|
||||
|
||||
va_start(va, format);
|
||||
vsprintf(buf, format, va);
|
||||
va_end(va);
|
||||
|
||||
VFSFileWrite (*stdout, StrLen(buf), buf, &numBytesWritten);
|
||||
// MemPtrFree(buf);
|
||||
return numBytesWritten;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Int16 sprintf(Char* s, const Char* formatStr, ...)
|
||||
{
|
||||
Char buf[256];
|
||||
// Char *buf = (Char *)MemPtrNew(256);
|
||||
Int16 count;
|
||||
va_list va;
|
||||
|
||||
va_start(va, formatStr);
|
||||
count = vsprintf(buf, formatStr, va);
|
||||
va_end(va);
|
||||
|
||||
StrCopy(s,buf);
|
||||
// MemPtrFree(buf);
|
||||
return count;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Int16 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam)
|
||||
{
|
||||
Char format[256];
|
||||
// TODO : need a better modifier
|
||||
StrCopy(format,formatStr);
|
||||
StrReplace(format, 256, "%ld", "%d");
|
||||
StrReplace(format, 256, "%li", "%i");
|
||||
StrReplace(format, 256, "%lx", "%x");
|
||||
StrReplace(format, 256, "%lx", "%X");
|
||||
StrReplace(format, 256, "%2ld", "%2d");
|
||||
StrReplace(format, 256, "%03ld","%.3d");
|
||||
StrReplace(format, 256, "%02ld","%.2d");
|
||||
StrReplace(format, 256, "%01ld","%.1d");
|
||||
StrReplace(format, 256, "%02ld","%02d");
|
||||
|
||||
StrReplace(format, 256, "%2ld","%2d");
|
||||
StrReplace(format, 256, "%3ld","%3d");
|
||||
StrReplace(format, 256, "%4ld","%4d");
|
||||
StrReplace(format, 256, "%5ld","%5d");
|
||||
StrReplace(format, 256, "%6ld","%6d");
|
||||
StrReplace(format, 256, "%02lx","%02x");
|
||||
|
||||
return StrVPrintF(s, format, argParam);;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
213
backends/PalmOS/Src/missing/_stdlib.cpp
Normal file
213
backends/PalmOS/Src/missing/_stdlib.cpp
Normal file
@ -0,0 +1,213 @@
|
||||
#include "stdlib.h"
|
||||
#include "MemGlue.h"
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/*void qsort(void *base, UInt32 nmemb, UInt32 size, ComparF *compar) {
|
||||
|
||||
SysQSort(base, nmemb, size, compar);
|
||||
}*/
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void *bsearch(const void *key, const void *base, UInt32 nmemb,
|
||||
UInt32 size, int (*compar)(const void *, const void *)) {
|
||||
UInt32 i;
|
||||
|
||||
for (i=0; i<nmemb; i++)
|
||||
if (compar(key, (void*)((UInt32)base + size * i)) == 0)
|
||||
return (void*)((UInt32)base + size * i);
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
static DmOpenRef gExtMemory = NULL;
|
||||
|
||||
static UInt16 MemFindHeapID(UInt32 size)
|
||||
{
|
||||
UInt32 nFree, maxChunk ;
|
||||
UInt16 maxCards = 1; //MemNumCards(); process only first card for now
|
||||
UInt16 heapID = -1; // no heap avaliable
|
||||
|
||||
UInt16 cardNo;
|
||||
UInt16 maxHeaps, heapIndex;
|
||||
|
||||
for (cardNo = 0; cardNo < maxCards; cardNo++)
|
||||
{
|
||||
if (MemNumRAMHeaps(cardNo) > 0)
|
||||
{
|
||||
maxHeaps = MemNumHeaps(cardNo);
|
||||
for (heapIndex = 0; heapIndex < maxHeaps; heapIndex++)
|
||||
{
|
||||
// Obtain the ID of the heap.
|
||||
heapID = MemHeapID(cardNo, heapIndex);
|
||||
|
||||
if (!(MemHeapFlags(heapID) & memHeapFlagReadOnly))
|
||||
{
|
||||
MemHeapFreeBytes( heapID, &nFree, &maxChunk );
|
||||
if (maxChunk > size)
|
||||
return heapID;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return heapID;
|
||||
}
|
||||
|
||||
void MemExtInit()
|
||||
{
|
||||
if (!gExtMemory)
|
||||
{
|
||||
LocalID localID = DmFindDatabase(0, "ScummVM-Memory");
|
||||
if (localID) DmDeleteDatabase(0, localID);
|
||||
|
||||
if (DmCreateDatabase (0, "ScummVM-Memory", 'ScVM', 'DATA', false) != errNone)
|
||||
return;
|
||||
|
||||
localID = DmFindDatabase(0, "ScummVM-Memory");
|
||||
gExtMemory = DmOpenDatabase(0, localID, dmModeReadWrite|dmModeExclusive);
|
||||
}
|
||||
}
|
||||
|
||||
void MemExtCleanup()
|
||||
{
|
||||
if (gExtMemory) {
|
||||
DmCloseDatabase(gExtMemory);
|
||||
LocalID localID = DmFindDatabase(0, "ScummVM-Memory");
|
||||
if (localID)
|
||||
DmDeleteDatabase(0, localID);
|
||||
}
|
||||
}
|
||||
//#define USE_EXTENDEDMEM
|
||||
#ifdef USE_EXTENDEDMEM
|
||||
|
||||
MemPtr calloc(UInt32 nelem, UInt32 elsize)
|
||||
{
|
||||
UInt32 size = nelem*elsize;
|
||||
MemPtr newP = NULL;
|
||||
UInt16 heapID = MemFindHeapID(size);
|
||||
|
||||
if (heapID != NO_HEAP_FOUND)
|
||||
{
|
||||
if (MemHeapDynamic(heapID) && size < 65536-8) // 8 = chunk header size
|
||||
newP = MemPtrNew(size);
|
||||
else
|
||||
{
|
||||
SysAppInfoPtr appInfoP;
|
||||
UInt16 ownerID, large, nmovable;
|
||||
UInt16 attr;
|
||||
|
||||
ownerID = ((SysAppInfoPtr)SysGetAppInfo(&appInfoP, &appInfoP))->memOwnerID;
|
||||
large = ((size > 65536-8) ? memNewChunkFlagAllowLarge : 0);
|
||||
nmovable= (MemHeapDynamic(heapID) ? memNewChunkFlagNonMovable : memNewChunkFlagPreLock);
|
||||
attr = ownerID|large|nmovable;
|
||||
|
||||
//MEMORY_RESERVE_ACCESS
|
||||
newP = MemChunkNew(heapID, size, attr);
|
||||
//MEMORY_RELEASE_ACCESS
|
||||
|
||||
if (newP && MemPtrDataStorage(newP)) { // if storage heap ?
|
||||
if (!gExtMemory) { // if memory DB doesn't exist
|
||||
MemChunkFree(newP);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
UInt16 index = dmMaxRecordIndex; // used for record purpose
|
||||
MemHandle newH = MemPtrRecoverHandle(newP); // exists
|
||||
if (DmAttachRecord(gExtMemory, &index, newH, NULL) != errNone) // attach to DB
|
||||
{
|
||||
MemChunkFree(newP); // error
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (newP)
|
||||
MemSet(newP,size,0);
|
||||
|
||||
return newP;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
MemPtr calloc(UInt32 nelem, UInt32 elsize)
|
||||
{
|
||||
UInt32 size = nelem*elsize;
|
||||
MemPtr newP = NULL;
|
||||
|
||||
/* if (size < 65536-8) // 8 = chunk header size
|
||||
newP = MemPtrNew(size);
|
||||
else*/
|
||||
/* {
|
||||
SysAppInfoPtr appInfoP;
|
||||
UInt16 ownerID;
|
||||
UInt16 attr;
|
||||
|
||||
ownerID = ((SysAppInfoPtr)SysGetAppInfo(&appInfoP, &appInfoP))->memOwnerID;
|
||||
attr = ownerID|memNewChunkFlagAllowLarge|memNewChunkFlagNonMovable;
|
||||
|
||||
newP = MemChunkNew(0, size, attr);
|
||||
}
|
||||
*/
|
||||
newP = MemGluePtrNew(size);
|
||||
|
||||
if (newP)
|
||||
MemSet(newP,size,0);
|
||||
|
||||
return newP;
|
||||
}
|
||||
|
||||
#endif
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#ifdef USE_EXTENDEDMEM
|
||||
Err free(MemPtr memP)
|
||||
{
|
||||
Err err = memErrInvalidParam;
|
||||
|
||||
if (!memP)
|
||||
return err;
|
||||
|
||||
if (MemPtrDataStorage(memP)) { // if storage heap ?
|
||||
if (gExtMemory) { // if memory DB exists
|
||||
DmOpenRef where;
|
||||
MemHandle newH = MemPtrRecoverHandle(memP);
|
||||
UInt16 index = DmSearchRecord(newH, &where);
|
||||
err = DmRemoveRecord(gExtMemory, index);
|
||||
}
|
||||
}
|
||||
else
|
||||
err = MemChunkFree(memP);
|
||||
|
||||
return err;
|
||||
}
|
||||
#else
|
||||
Err free(MemPtr memP)
|
||||
{
|
||||
if (memP)
|
||||
return MemPtrFree(memP);
|
||||
|
||||
return memErrInvalidParam;
|
||||
}
|
||||
#endif
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
MemPtr realloc(MemPtr oldP, UInt32 size)
|
||||
{
|
||||
|
||||
if (oldP != NULL)
|
||||
if (MemPtrResize(oldP,size) == 0)
|
||||
return oldP;
|
||||
|
||||
MemPtr newP = MemPtrNew(size);
|
||||
|
||||
if (oldP!=NULL)
|
||||
{
|
||||
MemMove(newP,oldP,MemPtrSize(oldP));
|
||||
MemPtrFree(oldP);
|
||||
}
|
||||
return newP;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
void exit(Int16 status)
|
||||
{
|
||||
// need to change this
|
||||
EventType event;
|
||||
event.eType = appStopEvent;
|
||||
EvtAddEventToQueue (&event);
|
||||
}
|
86
backends/PalmOS/Src/missing/_string.cpp
Normal file
86
backends/PalmOS/Src/missing/_string.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
#include "string.h"
|
||||
|
||||
Char *StrTokNext;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Char *strtok(Char *str, const Char *sep)
|
||||
{
|
||||
Char *position = NULL,
|
||||
*found,
|
||||
*end;
|
||||
|
||||
UInt16 loop = 0,
|
||||
chars= StrLen(sep);
|
||||
|
||||
str = (str)?(str):(StrTokNext);
|
||||
StrTokNext = NULL;
|
||||
|
||||
if (!str)
|
||||
return NULL;
|
||||
|
||||
end = str+StrLen(str);
|
||||
|
||||
while (loop<chars)
|
||||
{
|
||||
found = StrChr(str,sep[loop]);
|
||||
loop++;
|
||||
|
||||
if (found == str)
|
||||
{
|
||||
str++;
|
||||
loop = 0;
|
||||
}
|
||||
else if (position == NULL || position > found)
|
||||
position = found;
|
||||
}
|
||||
|
||||
if (position == NULL)
|
||||
if (str==end)
|
||||
return NULL;
|
||||
else
|
||||
return str;
|
||||
|
||||
position[0] = 0;
|
||||
StrTokNext = position+1;
|
||||
|
||||
return str;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Char *strpbrk(const Char *s1, const Char *s2)
|
||||
{
|
||||
Char *found;
|
||||
UInt32 n;
|
||||
|
||||
for (n=0; n <= StrLen(s2); n++) {
|
||||
found = StrChr(s1, s2[n]);
|
||||
if (found)
|
||||
return found;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Char *strrchr(const Char *s, int c)
|
||||
{
|
||||
UInt32 chr;
|
||||
UInt32 n = StrLen(s);
|
||||
|
||||
for(chr = n; chr >= 0; chr--)
|
||||
if ( *((UInt8 *)s+chr) == c)
|
||||
return (Char *)(s+chr);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
Char *strdup(const Char *s1)
|
||||
{
|
||||
Char* buf = (Char *)MemPtrNew(StrLen(s1)+1);
|
||||
|
||||
if(buf)
|
||||
StrCopy(buf, s1);
|
||||
|
||||
return buf;
|
||||
}
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
///////////////////////////////////////////////////////////////////////////////
|
38
backends/PalmOS/Src/missing/_time.cpp
Normal file
38
backends/PalmOS/Src/missing/_time.cpp
Normal file
@ -0,0 +1,38 @@
|
||||
#include "time.h"
|
||||
|
||||
// ignore GMT, only device time
|
||||
|
||||
time_t time(time_t *tloc) {
|
||||
UInt32 secs = TimGetSeconds(); // since 1/1/1904 12AM.
|
||||
DateTimeType Epoch = {0, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM
|
||||
|
||||
secs -= TimDateTimeToSeconds (&Epoch);
|
||||
|
||||
if (tloc)
|
||||
*tloc = secs;
|
||||
|
||||
return (secs);
|
||||
}
|
||||
|
||||
|
||||
struct tm *localtime(const time_t *timer) {
|
||||
static struct tm tmDate;
|
||||
|
||||
DateTimeType dt;
|
||||
UInt32 secs = *timer;
|
||||
DateTimeType Epoch = {0, 0, 0, 1, 1, 1970, 0}; // form 1/1/1904 12AM to 1/1/1970 12AM
|
||||
// timer supposed to be based on Epoch
|
||||
secs += TimDateTimeToSeconds(&Epoch);
|
||||
|
||||
TimSecondsToDateTime (secs, &dt);
|
||||
|
||||
tmDate.tm_sec = dt.second;
|
||||
tmDate.tm_min = dt.minute;
|
||||
tmDate.tm_hour = dt.hour;
|
||||
tmDate.tm_mday = dt.day;
|
||||
tmDate.tm_mon = dt.month;
|
||||
tmDate.tm_year = dt.year;
|
||||
tmDate.tm_wday = dt.weekDay;
|
||||
|
||||
return &tmDate;
|
||||
}
|
14
backends/PalmOS/Src/missing/_unistd.cpp
Normal file
14
backends/PalmOS/Src/missing/_unistd.cpp
Normal file
@ -0,0 +1,14 @@
|
||||
#include "unistd.h"
|
||||
#include "extend.h" // for SCUMMVM_SAVEPATH
|
||||
|
||||
|
||||
// currently used only to retreive savepath
|
||||
Char *getcwd(Char *buf, UInt32 size) {
|
||||
Char *copy = buf;
|
||||
|
||||
if (!copy)
|
||||
copy = (Char *)MemPtrNew(StrLen(SCUMMVM_SAVEPATH)); // this may never occured
|
||||
|
||||
StrCopy(copy, SCUMMVM_SAVEPATH);
|
||||
return copy;
|
||||
}
|
1
backends/PalmOS/Src/missing/assert.h
Normal file
1
backends/PalmOS/Src/missing/assert.h
Normal file
@ -0,0 +1 @@
|
||||
#define assert(a)
|
1
backends/PalmOS/Src/missing/fcntl.h
Normal file
1
backends/PalmOS/Src/missing/fcntl.h
Normal file
@ -0,0 +1 @@
|
||||
/* nothing */
|
1
backends/PalmOS/Src/missing/math.h
Normal file
1
backends/PalmOS/Src/missing/math.h
Normal file
@ -0,0 +1 @@
|
||||
#include "mathlib.h"
|
34
backends/PalmOS/Src/missing/stdio.h
Normal file
34
backends/PalmOS/Src/missing/stdio.h
Normal file
@ -0,0 +1,34 @@
|
||||
#include <PalmOS.h>
|
||||
#include <VFSMgr.h>
|
||||
#include <stdarg.h>
|
||||
#include "globals.h"
|
||||
|
||||
//extern UInt16 gVolRefNum;
|
||||
//extern FileRef gLogFile;
|
||||
|
||||
typedef FileRef FILE;
|
||||
|
||||
#define stdin 0
|
||||
#define stdout (&gVars->logFile)
|
||||
#define stderr (&gVars->logFile)
|
||||
|
||||
#define clearerr(a)
|
||||
#define fflush(a)
|
||||
#define vsnprintf(a,b,c,d) vsprintf(a,c,d)
|
||||
|
||||
#define SEEK_SET vfsOriginBeginning
|
||||
#define SEEK_CUR vfsOriginCurrent
|
||||
#define SEEK_END vfsOriginEnd
|
||||
|
||||
UInt16 fclose(FileRef *stream);
|
||||
UInt16 feof(FileRef *stream);
|
||||
Char *fgets(Char *s, UInt32 n, FileRef *stream);
|
||||
FileRef *fopen(const Char *filename, const Char *type);
|
||||
UInt32 fread(void *ptr, UInt32 size, UInt32 nitems, FileRef *stream);
|
||||
UInt32 fwrite(const void *ptr, UInt32 size, UInt32 nitems, FileRef *stream);
|
||||
Int32 fseek(FileRef *stream, Int32 offset, Int32 whence);
|
||||
UInt32 ftell(FileRef *stream);
|
||||
UInt16 fprintf(FileRef *stream, const Char *format, ...);
|
||||
Int16 printf(const Char* formatStr, ...);
|
||||
Int16 sprintf(Char* s, const Char* formatStr, ...);
|
||||
Int16 vsprintf(Char* s, const Char* formatStr, _Palm_va_list argParam);
|
38
backends/PalmOS/Src/missing/stdlib.h
Normal file
38
backends/PalmOS/Src/missing/stdlib.h
Normal file
@ -0,0 +1,38 @@
|
||||
#ifndef STDLIB_H
|
||||
#define STDLIB_H
|
||||
|
||||
#include <PalmOS.h>
|
||||
#include "mathlib.h"
|
||||
|
||||
//#define memNewChunkFlagNonMovable 0x0200
|
||||
#define memNewChunkFlagAllowLarge 0x1000 // this is not in the sdk *g*
|
||||
#define memHeapFlagReadOnly 0x0001
|
||||
|
||||
#define NO_HEAP_FOUND -1
|
||||
|
||||
SysAppInfoPtr SysGetAppInfo(SysAppInfoPtr *uiAppPP, SysAppInfoPtr *actionCodeAppPP)
|
||||
SYS_TRAP(sysTrapSysGetAppInfo);
|
||||
|
||||
|
||||
#define atoi StrAToI
|
||||
#define atol StrAToI
|
||||
#define abs(a) ((a) < 0 ? -(a) : (a))
|
||||
//#define abs fabs
|
||||
#define malloc(a) calloc(a,1)
|
||||
//#define free MemPtrFree
|
||||
#define strtol(a,b,c) StrAToI(a)
|
||||
#define qsort(a,b,c,d)
|
||||
#define rand() SysRandom(0)
|
||||
|
||||
void MemExtInit();
|
||||
void MemExtCleanup();
|
||||
|
||||
MemPtr realloc(MemPtr oldP, UInt32 size);
|
||||
MemPtr calloc(UInt32 nelem, UInt32 elsize);
|
||||
Err free(MemPtr memP);
|
||||
void exit(Int16 status);
|
||||
void *bsearch(const void *key, const void *base, UInt32 nmemb,
|
||||
UInt32 size, int (*compar)(const void *, const void *));
|
||||
|
||||
|
||||
#endif
|
22
backends/PalmOS/Src/missing/string.h
Normal file
22
backends/PalmOS/Src/missing/string.h
Normal file
@ -0,0 +1,22 @@
|
||||
#include <PalmOS.h>
|
||||
|
||||
#define memcmp MemCmp
|
||||
#define memcpy MemMove
|
||||
#define memmove MemMove
|
||||
#define memset(a,b,c) MemSet(a,c,b)
|
||||
#define strcat StrCat
|
||||
#define strchr StrChr
|
||||
#define strcmp StrCompare
|
||||
#define strcpy StrCopy
|
||||
#define strncpy StrNCopy
|
||||
#define stricmp StrCaselessCompare
|
||||
#define strlen StrLen
|
||||
#define strncmp StrNCompare
|
||||
#define strstr StrStr
|
||||
|
||||
Char *strtok(Char *str, const Char *sep);
|
||||
Char *strrchr(const Char *s, int c);
|
||||
Char *strdup(const Char *strSource);
|
||||
Char *strpbrk(const Char *s1, const Char *s2);
|
||||
|
||||
#define StrTok strtok
|
1
backends/PalmOS/Src/missing/sys/stat.h
Normal file
1
backends/PalmOS/Src/missing/sys/stat.h
Normal file
@ -0,0 +1 @@
|
||||
/* nothing */
|
18
backends/PalmOS/Src/missing/time.h
Normal file
18
backends/PalmOS/Src/missing/time.h
Normal file
@ -0,0 +1,18 @@
|
||||
#include <PalmOS.h>
|
||||
|
||||
typedef UInt32 time_t;
|
||||
|
||||
struct tm {
|
||||
Int16 tm_sec; // seconds [0,61]
|
||||
Int16 tm_min; // minutes [0,59]
|
||||
Int16 tm_hour; // hour [0,23]
|
||||
Int16 tm_mday; // day of month [1,31]
|
||||
Int16 tm_mon; // month of year [0,11]
|
||||
Int16 tm_year; // years since 1900
|
||||
Int16 tm_wday; // day of week [0,6] (Sunday = 0)
|
||||
Int16 tm_yday; // day of year [0,365]
|
||||
Int16 tm_isdst; // daylight savings flag
|
||||
};
|
||||
|
||||
time_t time(time_t *tloc);
|
||||
struct tm *localtime(const time_t *timer);
|
3
backends/PalmOS/Src/missing/unistd.h
Normal file
3
backends/PalmOS/Src/missing/unistd.h
Normal file
@ -0,0 +1,3 @@
|
||||
#include <PalmOS.h>
|
||||
|
||||
Char *getcwd(Char *buf, UInt32 size);
|
1325
backends/PalmOS/Src/palm.cpp
Normal file
1325
backends/PalmOS/Src/palm.cpp
Normal file
File diff suppressed because it is too large
Load Diff
263
backends/PalmOS/Src/palm.h
Normal file
263
backends/PalmOS/Src/palm.h
Normal file
@ -0,0 +1,263 @@
|
||||
#ifndef PALM_H
|
||||
#define PALM_H
|
||||
|
||||
#include <SonyClie.h>
|
||||
#include "SonySndLib.h"
|
||||
#include "vibrate.h"
|
||||
#include "globals.h"
|
||||
#include "system.h"
|
||||
/*
|
||||
typedef struct {
|
||||
|
||||
UInt16 HRrefNum;
|
||||
UInt16 volRefNum;
|
||||
FileRef logFile;
|
||||
|
||||
Boolean screenLocked;
|
||||
Boolean vibrator;
|
||||
|
||||
} GlobalsDataType;
|
||||
*/
|
||||
//extern UInt16 gHRrefNum;
|
||||
//extern Boolean gVibrator;
|
||||
//extern Boolean gFlipping;
|
||||
//extern Boolean gScreenLocked;
|
||||
//extern GlobalsDataType *gVars;
|
||||
|
||||
//Err CheckHRmode();
|
||||
|
||||
|
||||
Err HwrDisplayPalette(UInt8 operation, Int16 startIndex,
|
||||
UInt16 paletteEntries, RGBColorType *tableP)
|
||||
SYS_TRAP(sysTrapHwrDisplayPalette);
|
||||
|
||||
|
||||
//-- 02-12-17 --////////////////////////////////////////////////////////////////
|
||||
class OSystem_PALMOS : public OSystem {
|
||||
public:
|
||||
// Set colors of the palette
|
||||
void set_palette(const byte *colors, uint start, uint num);
|
||||
|
||||
// Set the size of the video bitmap.
|
||||
// Typically, 320x200
|
||||
void init_size(uint w, uint h);
|
||||
|
||||
// Draw a bitmap to screen.
|
||||
// The screen will not be updated to reflect the new bitmap
|
||||
void copy_rect(const byte *buf, int pitch, int x, int y, int w, int h);
|
||||
|
||||
// Moves the screen content around by the given amount of pixels
|
||||
// but only the top height pixel rows, the rest stays untouched
|
||||
void move_screen(int dx, int dy, int height);
|
||||
|
||||
// Update the dirty areas of the screen
|
||||
void update_screen();
|
||||
|
||||
// Either show or hide the mouse cursor
|
||||
bool show_mouse(bool visible);
|
||||
|
||||
// Set the position of the mouse cursor
|
||||
void set_mouse_pos(int x, int y);
|
||||
|
||||
// Warp the mouse cursor. Where set_mouse_pos() only informs the
|
||||
// backend of the mouse cursor's current position, this function
|
||||
// actually moves the cursor to the specified position.
|
||||
void warp_mouse(int x, int y);
|
||||
|
||||
|
||||
// Set the bitmap that's used when drawing the cursor.
|
||||
void set_mouse_cursor(const byte *buf, uint w, uint h, int hotspot_x, int hotspot_y);
|
||||
|
||||
// Shaking is used in SCUMM. Set current shake position.
|
||||
void set_shake_pos(int shake_pos);
|
||||
|
||||
// Get the number of milliseconds since the program was started.
|
||||
uint32 get_msecs();
|
||||
|
||||
// Delay for a specified amount of milliseconds
|
||||
void delay_msecs(uint msecs);
|
||||
|
||||
// Create a thread
|
||||
void *create_thread(ThreadProc *proc, void *param);
|
||||
|
||||
// Get the next event.
|
||||
// Returns true if an event was retrieved.
|
||||
bool poll_event(Event *event);
|
||||
|
||||
void SimulateArrowKeys(Event *event, Int8 iHoriz, Int8 iVert, Boolean repeat);
|
||||
|
||||
// Set function that generates samples
|
||||
bool set_sound_proc(void *param, SoundProc *proc, byte sound);
|
||||
|
||||
// Poll cdrom status
|
||||
// Returns true if cd audio is playing
|
||||
bool poll_cdrom();
|
||||
|
||||
// Play cdrom audio track
|
||||
void play_cdrom(int track, int num_loops, int start_frame, int end_frame);
|
||||
|
||||
// Stop cdrom audio track
|
||||
void stop_cdrom();
|
||||
|
||||
// Update cdrom audio status
|
||||
void update_cdrom();
|
||||
|
||||
// Add a callback timer
|
||||
void set_timer(int timer, int (*callback)(int));
|
||||
|
||||
// Mutex handling
|
||||
void *create_mutex(void);
|
||||
void lock_mutex(void *mutex);
|
||||
void unlock_mutex(void *mutex);
|
||||
void delete_mutex(void *mutex);
|
||||
|
||||
// Quit
|
||||
void quit();
|
||||
bool _quit;
|
||||
|
||||
// Overlay
|
||||
void show_overlay();
|
||||
void hide_overlay();
|
||||
void clear_overlay();
|
||||
void grab_overlay(byte *buf, int pitch);
|
||||
void copy_rect_overlay(const byte *buf, int pitch, int x, int y, int w, int h);
|
||||
|
||||
int16 get_width();
|
||||
int16 get_height();
|
||||
byte RGBToColor(uint8 r, uint8 g, uint8 b);
|
||||
void ColorToRGB(byte color, uint8 &r, uint8 &g, uint8 &b);
|
||||
// Set a parameter
|
||||
uint32 property(int param, Property *value);
|
||||
|
||||
// Savefile management
|
||||
SaveFileManager *get_savefile_manager();
|
||||
|
||||
static OSystem *create(UInt16 gfx_mode);
|
||||
|
||||
UInt8 _sndHandle;
|
||||
Boolean _isPlaying;
|
||||
|
||||
protected:
|
||||
bool _overlay_visible;
|
||||
|
||||
private:
|
||||
struct {
|
||||
Int16 state;
|
||||
Int16 position;
|
||||
UInt32 time;
|
||||
UInt32 wait;
|
||||
UInt8 color;
|
||||
Char text[100];
|
||||
} _msg;
|
||||
|
||||
void addMessage(const Char *msg);
|
||||
void drawMessage();
|
||||
void deleteMessage();
|
||||
|
||||
typedef void (OSystem_PALMOS::*RendererProc)(void);
|
||||
RendererProc _renderer_proc;
|
||||
|
||||
UInt8 *_sndData;
|
||||
|
||||
void update_screen__flipping();
|
||||
void update_screen__dbuffer();
|
||||
void update_screen__direct();
|
||||
|
||||
WinHandle h_palm_screen;
|
||||
WinHandle h_palm_offscreen;
|
||||
WinHandle h_palm_tmpscreen;
|
||||
|
||||
byte *palm_screen;
|
||||
byte *palm_offscreen;
|
||||
byte *palm_tmpscreen;
|
||||
|
||||
bool _mouse_visible;
|
||||
bool _mouse_drawn;
|
||||
|
||||
enum {
|
||||
MAX_MOUSE_W = 40,
|
||||
MAX_MOUSE_H = 40
|
||||
};
|
||||
|
||||
int SCREEN_WIDTH, SCREEN_HEIGHT;
|
||||
bool _overlaySaved;
|
||||
|
||||
struct MousePos {
|
||||
int16 x,y,w,h;
|
||||
};
|
||||
|
||||
UInt16 _mode;
|
||||
byte *_mouse_data;
|
||||
byte *_mouse_backup;
|
||||
MousePos _mouse_cur_state;
|
||||
MousePos _mouse_old_state;
|
||||
int16 _mouse_hotspot_x;
|
||||
int16 _mouse_hotspot_y;
|
||||
int _current_shake_pos;
|
||||
int _new_shake_pos;
|
||||
|
||||
UInt16 _decaly, _screeny;
|
||||
Boolean _vibrate;
|
||||
UInt32 _exit_delay;
|
||||
|
||||
struct {
|
||||
uint32 duration, next_expiry;
|
||||
bool active;
|
||||
int (*callback) (int);
|
||||
} _timer;
|
||||
|
||||
struct {
|
||||
bool active;
|
||||
ThreadProc *proc;
|
||||
void *param;
|
||||
|
||||
struct {
|
||||
UInt32 value;
|
||||
UInt32 status;
|
||||
} sleep;
|
||||
|
||||
} _thread;
|
||||
|
||||
struct {
|
||||
bool active;
|
||||
SoundProc *proc;
|
||||
void *param;
|
||||
} _sound;
|
||||
|
||||
// Palette data
|
||||
RGBColorType *_currentPalette;
|
||||
uint _paletteDirtyStart, _paletteDirtyEnd;
|
||||
|
||||
void check_sound();
|
||||
|
||||
void draw_mouse();
|
||||
void undraw_mouse();
|
||||
|
||||
void load_gfx_mode();
|
||||
void unload_gfx_mode();
|
||||
/*
|
||||
void hotswap_gfx_mode();
|
||||
|
||||
void get_320x200_image(byte *buf);
|
||||
*/ static void autosave();
|
||||
|
||||
// PALM spec
|
||||
|
||||
void drawKeyState();
|
||||
|
||||
Int32 lastKeyPressed;
|
||||
UInt32 lastKeyRepeat;
|
||||
UInt8 lastKeyModifier;
|
||||
|
||||
eventsEnum lastEvent;
|
||||
|
||||
// sound support
|
||||
SndPcmFormatType _snd_format;
|
||||
SndPcmOptionsType _snd_options;
|
||||
|
||||
|
||||
OSystem_PALMOS();
|
||||
|
||||
};
|
||||
|
||||
#endif
|
160
backends/PalmOS/Src/palmsave.cpp
Normal file
160
backends/PalmOS/Src/palmsave.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
#include <ctype.h>
|
||||
#include "common/scummsys.h"
|
||||
//#include "common/stdafx.h"
|
||||
#include "common/engine.h"
|
||||
#include "scumm/saveload.h"
|
||||
#include "palm.h"
|
||||
//#include "gui/newgui.h"
|
||||
//#include "gui/message.h"
|
||||
|
||||
#define MAX_BLOCK 64000
|
||||
|
||||
// SaveFile class
|
||||
|
||||
class PalmSaveFile : public SaveFile {
|
||||
public:
|
||||
PalmSaveFile(const char *filename, const char *mode);
|
||||
~PalmSaveFile();
|
||||
|
||||
bool is_open() { return file != NULL; }
|
||||
int fread(void *buf, int size, int cnt);
|
||||
int fwrite(void *buf, int size, int cnt);
|
||||
// must be removed
|
||||
int feof() { return ::feof(file); }
|
||||
|
||||
private :
|
||||
FILE *file;
|
||||
UInt8 * _readWriteData;
|
||||
UInt32 _readWritePos;
|
||||
bool _needDump;
|
||||
};
|
||||
|
||||
PalmSaveFile::PalmSaveFile(const char *filename, const char *mode) {
|
||||
_readWriteData = NULL;
|
||||
_readWritePos = 0;
|
||||
_needDump = false;
|
||||
|
||||
file = ::fopen(filename, mode);
|
||||
}
|
||||
|
||||
PalmSaveFile::~PalmSaveFile() {
|
||||
if (file) {
|
||||
if (_needDump && _readWriteData) {
|
||||
::fwrite(_readWriteData, _readWritePos, 1, file);
|
||||
free(_readWriteData);
|
||||
}
|
||||
|
||||
::fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
int PalmSaveFile::fread(void *buf, int size, int cnt) {
|
||||
return ::fread(buf, size, cnt, file);
|
||||
}
|
||||
|
||||
int PalmSaveFile::fwrite(void *buf, int size, int cnt) {
|
||||
UInt32 fullsize = size*cnt;
|
||||
|
||||
if (fullsize<=MAX_BLOCK)
|
||||
{
|
||||
if (!_readWriteData)
|
||||
_readWriteData = (byte *)malloc(MAX_BLOCK);
|
||||
|
||||
if ((_readWritePos+fullsize)>MAX_BLOCK) {
|
||||
::fwrite(_readWriteData, _readWritePos, 1, file);
|
||||
_readWritePos = 0;
|
||||
_needDump = false;
|
||||
}
|
||||
|
||||
MemMove(_readWriteData + _readWritePos, buf, fullsize);
|
||||
_readWritePos += fullsize;
|
||||
_needDump = true;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
return ::fwrite(buf, size, cnt, file);
|
||||
}
|
||||
|
||||
// SaveFileManager class
|
||||
|
||||
class PalmSaveFileManager : public SaveFileManager {
|
||||
|
||||
public:
|
||||
/* SaveFile *open_savefile(const char *filename,
|
||||
bool saveOrLoad)
|
||||
{
|
||||
PalmSaveFile *sf = new PalmSaveFile(filename,
|
||||
(saveOrLoad? "wb":"rb"));
|
||||
if(!sf->is_open()) {
|
||||
delete sf;
|
||||
sf = NULL;
|
||||
}
|
||||
return sf;
|
||||
}
|
||||
|
||||
void list_savefiles(const char *prefix,
|
||||
bool *marks, int num)
|
||||
{
|
||||
memset(marks, true, num*sizeof(bool));
|
||||
}
|
||||
*/
|
||||
SaveFile *open_savefile(const char *filename, bool saveOrLoad);
|
||||
void list_savefiles(const char *prefix, bool *marks, int num);
|
||||
};
|
||||
|
||||
SaveFile *PalmSaveFileManager::open_savefile(const char *filename, bool saveOrLoad) {
|
||||
PalmSaveFile *sf = new PalmSaveFile(filename, (saveOrLoad? "wb":"rb"));
|
||||
|
||||
if(!sf->is_open()) {
|
||||
delete sf;
|
||||
sf = NULL;
|
||||
}
|
||||
|
||||
return sf;
|
||||
}
|
||||
|
||||
void PalmSaveFileManager::list_savefiles(const char *prefix, bool *marks, int num) {
|
||||
FileRef fileRef;
|
||||
// try to open the dir
|
||||
Err e = VFSFileOpen(gVars->volRefNum, SCUMMVM_SAVEPATH, vfsModeRead, &fileRef);
|
||||
memset(marks, false, num*sizeof(bool));
|
||||
|
||||
if (e != errNone)
|
||||
return;
|
||||
|
||||
// enumerate all files
|
||||
Char *nameonly = strrchr(prefix,'/') + 1;
|
||||
UInt32 dirEntryIterator = vfsIteratorStart;
|
||||
Char filename[32];
|
||||
FileInfoType info = {0, filename, 32};
|
||||
UInt16 length = StrLen(nameonly);
|
||||
int slot = 0;
|
||||
|
||||
while (dirEntryIterator != vfsIteratorStop) {
|
||||
e = VFSDirEntryEnumerate (fileRef, &dirEntryIterator, &info);
|
||||
|
||||
if (e != expErrEnumerationEmpty) { // there is something
|
||||
|
||||
if (StrLen(info.nameP) == (length + 2)) { // consider max 99, filename length is ok
|
||||
if (StrNCaselessCompare(nameonly, info.nameP, length) == 0) { // this seems to be a save file
|
||||
if (isdigit(info.nameP[length]) && isdigit(info.nameP[length+1])) {
|
||||
|
||||
slot = StrAToI(filename + length);
|
||||
if (slot >= 0 && slot < num)
|
||||
*(marks+slot) = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
VFSFileClose(fileRef);
|
||||
}
|
||||
|
||||
// OSystem
|
||||
SaveFileManager *OSystem_PALMOS::get_savefile_manager() {
|
||||
return new PalmSaveFileManager();
|
||||
}
|
3180
backends/PalmOS/Src/palmstart.cpp
Normal file
3180
backends/PalmOS/Src/palmstart.cpp
Normal file
File diff suppressed because it is too large
Load Diff
92
backends/PalmOS/Src/saveslot.cpp
Normal file
92
backends/PalmOS/Src/saveslot.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
//#include "extras.h"
|
||||
#include <string.h>
|
||||
#include "scummsys.h"
|
||||
#include "saveload.h"
|
||||
|
||||
#define MAX_BLOCK 64000
|
||||
|
||||
enum SaveLoadState {
|
||||
STATE_LOAD,
|
||||
STATE_SAVE,
|
||||
STATE_NONE
|
||||
};
|
||||
|
||||
class SaveLoadData {
|
||||
public:
|
||||
SaveLoadData();
|
||||
|
||||
SaveLoadState _currentState;
|
||||
byte * _readWriteData;
|
||||
uint32 _readWritePos;
|
||||
bool _needDump;
|
||||
};
|
||||
|
||||
SaveLoadData current;
|
||||
|
||||
SaveLoadData::SaveLoadData()
|
||||
{
|
||||
_currentState = STATE_NONE;
|
||||
_readWritePos = 0;
|
||||
_needDump = false;
|
||||
}
|
||||
|
||||
bool SerializerStream::fopen(const char *filename, const char *mode)
|
||||
{
|
||||
if (current._currentState != STATE_NONE)
|
||||
fclose();
|
||||
|
||||
context = ::fopen(filename, mode);
|
||||
if (context != NULL) {
|
||||
current._currentState = ((strcmp(mode,"rb")==0) ? STATE_LOAD : STATE_SAVE);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int SerializerStream::fread(void *buf, int size, int cnt)
|
||||
{
|
||||
return ::fread(buf, size, cnt, (FILE *)context);
|
||||
}
|
||||
|
||||
int SerializerStream::fwrite(void *buf, int size, int cnt) {
|
||||
|
||||
int fullsize = size*cnt;
|
||||
|
||||
if (current._currentState == STATE_SAVE && fullsize<=MAX_BLOCK)
|
||||
{
|
||||
if (!current._readWriteData)
|
||||
current._readWriteData = (byte *)malloc(MAX_BLOCK);
|
||||
|
||||
if ((current._readWritePos+fullsize)>MAX_BLOCK) {
|
||||
::fwrite(current._readWriteData, current._readWritePos, 1, (FILE *)context);
|
||||
current._readWritePos = 0;
|
||||
current._needDump = false;
|
||||
}
|
||||
|
||||
memcpy(current._readWriteData + current._readWritePos, buf, fullsize);
|
||||
current._readWritePos += fullsize;
|
||||
current._needDump = true;
|
||||
|
||||
return cnt;
|
||||
}
|
||||
|
||||
return ::fwrite(buf, size, cnt, (FILE *)context);
|
||||
}
|
||||
|
||||
|
||||
void SerializerStream::fclose()
|
||||
{
|
||||
if (current._needDump && current._readWriteData != NULL) {
|
||||
if (current._currentState == STATE_SAVE)
|
||||
::fwrite(current._readWriteData, current._readWritePos, 1, (FILE *)context);
|
||||
|
||||
free(current._readWriteData);
|
||||
current._readWriteData = NULL;
|
||||
}
|
||||
|
||||
current._readWritePos = 0;
|
||||
current._needDump = false;
|
||||
current._currentState = STATE_NONE;
|
||||
::fclose((FILE *)context);
|
||||
}
|
50
backends/PalmOS/Src/scumm_globals.h
Normal file
50
backends/PalmOS/Src/scumm_globals.h
Normal file
@ -0,0 +1,50 @@
|
||||
#define GBVARS_DIGSTATEMUSICMAP_INDEX 0
|
||||
#define GBVARS_DIGSTATEMUSICTABLE_INDEX 1
|
||||
#define GBVARS_COMISTATEMUSICTABLE_INDEX 2
|
||||
#define GBVARS_COMISEQMUSICTABLE_INDEX 3
|
||||
#define GBVARS_DIGSEQMUSICTABLE_INDEX 4
|
||||
#define GBVARS_FTSTATEMUSICTABLE_INDEX 5
|
||||
#define GBVARS_FTSEQMUSICTABLE_INDEX 6
|
||||
#define GBVARS_GUIFONT_INDEX 7
|
||||
#define GBVARS_OLD256MIDIHACK_INDEX 8 // fix me : sizeof is used on scummvm
|
||||
#define GBVARS_CODEC37TABLE_INDEX 9
|
||||
#define GBVARS_CODEC47TABLE_INDEX 10
|
||||
#define GBVARS_TRANSITIONEFFECTS_INDEX 11
|
||||
|
||||
#define GBVARS_SIMON1SETTINGS_INDEX 0
|
||||
#define GBVARS_SIMON1AMIGASETTINGS_INDEX 1
|
||||
#define GBVARS_SIMON1DEMOSETTINGS_INDEX 2
|
||||
#define GBVARS_SIMON2WINSETTINGS_INDEX 3
|
||||
#define GBVARS_SIMON2MACSETTINGS_INDEX 4
|
||||
#define GBVARS_SIMON2DOSSETTINGS_INDEX 5
|
||||
#define GBVARS_HEBREWVIDEOFONT_INDEX 6
|
||||
#define GBVARS_SPANISHVIDEOFONT_INDEX 7
|
||||
#define GBVARS_VIDEOFONT_INDEX 8
|
||||
|
||||
#define GBVARS_SCUMM 0
|
||||
#define GBVARS_SIMON 1
|
||||
#define GBVARS_SKY 2
|
||||
|
||||
#define GSETPTR(var,index,format,id) var = (format *)GBGetRecord(index,id);
|
||||
#define GRELEASEPTR(index,id) GBReleaseRecord(index,id);
|
||||
|
||||
void *GBGetRecord(UInt16 index, UInt16 id);
|
||||
void GBReleaseRecord(UInt16 index, UInt16 id);
|
||||
|
||||
void IMuseDigital_initGlobals();
|
||||
void IMuseDigital_releaseGlobals();
|
||||
|
||||
void Simon_initGlobals();
|
||||
void Simon_releaseGlobals();
|
||||
|
||||
void NewGui_initGlobals();
|
||||
void NewGui_releaseGlobals();
|
||||
|
||||
void Resource_initGlobals();
|
||||
void Resource_releaseGlobals();
|
||||
|
||||
void Codec47_initGlobals();
|
||||
void Codec47_releaseGlobals();
|
||||
|
||||
void Gfx_initGlobals();
|
||||
void Gfx_releaseGlobals();
|
55
backends/PalmOS/Src/skin.h
Normal file
55
backends/PalmOS/Src/skin.h
Normal file
@ -0,0 +1,55 @@
|
||||
#define skinList 500
|
||||
#define skinColors 600
|
||||
//#define skinPalette 510
|
||||
#define skinButtonNone 0
|
||||
|
||||
#define skinSliderUpArrow 2000
|
||||
#define skinSliderDownArrow 2100
|
||||
|
||||
#define skinButtonGameParams 3000
|
||||
#define skinButtonGameAdd 3100
|
||||
#define skinButtonGameEdit 3200
|
||||
#define skinButtonGameDelete 4000
|
||||
#define skinButtonGameStart 7000
|
||||
|
||||
#define skinBackgroundImageTop 1000
|
||||
#define skinBackgroundImageBottom 1010
|
||||
///
|
||||
|
||||
|
||||
#define skinToolsBackground 1100
|
||||
|
||||
#define skinListUpArrowNormal 1500
|
||||
#define skinListUpArrowOver 1510
|
||||
#define skinListUpArrowDisabled 1540
|
||||
|
||||
#define skinListDownArrowNormal 1800
|
||||
#define skinListDownArrowOver 1810
|
||||
#define skinListDownArrowDisabled 1840
|
||||
|
||||
#define skinButtonGameInfoNormal 2000
|
||||
#define skinButtonGameInfoOver 2010
|
||||
#define skinButtonGameInfoDisabled 2040
|
||||
|
||||
#define skinButtonGameParamNormal 3000
|
||||
#define skinButtonGameParamOver 3010
|
||||
|
||||
#define skinButtonGameDeleteNormal 4000
|
||||
#define skinButtonGameDeleteOver 4010
|
||||
#define skinButtonGameDeleteDisabled 4040
|
||||
|
||||
#define skinButtonVibratorNormal 5000
|
||||
#define skinButtonVibratorOver 5010
|
||||
#define skinButtonVibratorSelected 5020
|
||||
#define skinButtonVibratorSelectedOver 5030
|
||||
#define skinButtonVibratorDisabled 5040
|
||||
|
||||
|
||||
#define skinButtonSleepNormal 6000
|
||||
#define skinButtonSleepOver 6010
|
||||
#define skinButtonSleepSelected 6020
|
||||
#define skinButtonSleepSelectedOver 9030
|
||||
|
||||
#define skinButtonPlayNormal 7000
|
||||
#define skinButtonPlayOver 7010
|
||||
#define skinButtonPlayDisabled 7040
|
61
backends/PalmOS/Src/vibrate.h
Normal file
61
backends/PalmOS/Src/vibrate.h
Normal file
@ -0,0 +1,61 @@
|
||||
/**********************************************************************
|
||||
** **
|
||||
** vibrate.h **
|
||||
** **
|
||||
** Definitions for setting/retrieving the state of the vibrator on **
|
||||
** PalmOS 4.x devices. These calls are not officially supported by **
|
||||
** Palm Inc and subsidiaries. It is not guaranteed that these calls **
|
||||
** will work at all or at least the same on every device. YOU ARE **
|
||||
** USING THESE ENTIRELY ON YOUR VERY OWN RISK ! **
|
||||
** **
|
||||
** Please send corrections to dseifert@dseifert.com **
|
||||
**********************************************************************/
|
||||
|
||||
#include <PalmOS.h>
|
||||
|
||||
/* HwrVibrateAttributes takes three arguments:
|
||||
** Boolean set Should the setting be set (1) or retrieved (0)
|
||||
** UInt32 setting what should be set
|
||||
** void* value pointer to the value to set, or to store the
|
||||
** retrieved setting
|
||||
*/
|
||||
|
||||
Err HwrVibrateAttributes(Boolean set, UInt32 setting, void *value)
|
||||
SYS_TRAP(sysTrapHwrVibrateAttributes);
|
||||
|
||||
/* to determine whether the vibrator is supported on a specific device, you
|
||||
** need to make sure that you are running on PalmOS 4.x (so that the
|
||||
** trap exists), that the attention manager exists and you need to check
|
||||
** whether HwrVibrateAttributes(0, 1, &active) returns an error code of
|
||||
** 0. ('active' is a Boolean).
|
||||
*/
|
||||
|
||||
|
||||
/***************************************************************/
|
||||
/* For the second parameter, the following defines can be used */
|
||||
/***************************************************************/
|
||||
|
||||
/* *value points to a Boolean stating the state of the vibrator */
|
||||
#define kHwrVibrateActive 1
|
||||
|
||||
/* *value points to a UInt16, specifying the length of one cycle.
|
||||
** value is in ticks (1/100 seconds) */
|
||||
#define kHwrVibrateRate 2
|
||||
|
||||
/* *value points to a UInt32, specifying the pattern of vibrating
|
||||
**
|
||||
** example:
|
||||
** 0xFFFFFFFF stay on, no vibrating
|
||||
** 0x0F0F0F0F vibrate four times in equal intervals
|
||||
** 0xAAAAAAAA vibrate really fast (not recommended)
|
||||
** 0x0F0F0000 vibrate twice, then pause
|
||||
*/
|
||||
#define kHwrVibratePattern 3
|
||||
|
||||
/* *value points to a UInt16, specifying the delay between two
|
||||
** cycles in ticks */
|
||||
#define kHwrVibrateDelay 4
|
||||
|
||||
/* *value points to a UInt16 specifying the amount of repeats. */
|
||||
#define kHwrVibrateRepeatCount 5
|
||||
|
155
backends/fs/palmos/palmos-fs.cpp
Normal file
155
backends/fs/palmos/palmos-fs.cpp
Normal file
@ -0,0 +1,155 @@
|
||||
/* ScummVM - Scumm Interpreter
|
||||
* Copyright (C) 2002 The ScummVM project
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*
|
||||
* $Header$
|
||||
*/
|
||||
|
||||
#if defined(__PALMOS_TRAPS__)
|
||||
|
||||
#include "../fs.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
/*
|
||||
* Implementation of the ScummVM file system API based on PalmOS VFS API.
|
||||
*/
|
||||
|
||||
class PalmOSFilesystemNode : public FilesystemNode {
|
||||
protected:
|
||||
String _displayName;
|
||||
bool _isDirectory;
|
||||
bool _isValid;
|
||||
bool _isPseudoRoot;
|
||||
String _path;
|
||||
|
||||
public:
|
||||
PalmOSFilesystemNode();
|
||||
PalmOSFilesystemNode(const Char *path);
|
||||
PalmOSFilesystemNode(const PalmOSFilesystemNode *node);
|
||||
|
||||
virtual String displayName() const { return _displayName; }
|
||||
virtual bool isValid() const { return _isValid; }
|
||||
virtual bool isDirectory() const { return _isDirectory; }
|
||||
virtual String path() const { return _path; }
|
||||
|
||||
virtual FSList *listDir(ListMode) const;
|
||||
virtual FilesystemNode *parent() const;
|
||||
virtual FilesystemNode *clone() const { return new PalmOSFilesystemNode(this); }
|
||||
|
||||
private:
|
||||
static void addFile (FSList* list, ListMode mode, const Char *base, FileInfoType* find_data);
|
||||
};
|
||||
|
||||
void PalmOSFilesystemNode::addFile (FSList* list, ListMode mode, const char *base, FileInfoType* find_data) {
|
||||
PalmOSFilesystemNode entry;
|
||||
bool isDirectory;
|
||||
|
||||
isDirectory = (find_data->attributes & vfsFileAttrDirectory);
|
||||
|
||||
if ((!isDirectory && mode == kListDirectoriesOnly) ||
|
||||
(isDirectory && mode == kListFilesOnly))
|
||||
return;
|
||||
|
||||
entry._isDirectory = isDirectory;
|
||||
entry._displayName = find_data->nameP;
|
||||
entry._path = base;
|
||||
entry._path += find_data->nameP;
|
||||
if (entry._isDirectory)
|
||||
entry._path += "/";
|
||||
|
||||
entry._isValid = true;
|
||||
entry._isPseudoRoot = false;
|
||||
list->push_back(entry);
|
||||
}
|
||||
|
||||
FilesystemNode *FilesystemNode::getRoot() {
|
||||
return new PalmOSFilesystemNode();
|
||||
}
|
||||
|
||||
PalmOSFilesystemNode::PalmOSFilesystemNode() {
|
||||
_isDirectory = true;
|
||||
_displayName = "Root";
|
||||
_isValid = true;
|
||||
_path = "/";
|
||||
_isPseudoRoot = true;
|
||||
}
|
||||
|
||||
PalmOSFilesystemNode::PalmOSFilesystemNode(const PalmOSFilesystemNode *node) {
|
||||
_displayName = node->_displayName;
|
||||
_isDirectory = node->_isDirectory;
|
||||
_isValid = node->_isValid;
|
||||
_isPseudoRoot = node->_isPseudoRoot;
|
||||
_path = node->_path;
|
||||
}
|
||||
|
||||
FSList *PalmOSFilesystemNode::listDir(ListMode mode) const {
|
||||
|
||||
FSList *myList = new FSList();
|
||||
Err e;
|
||||
Char nameP[256];
|
||||
FileInfoType desc;
|
||||
FileRef handle;
|
||||
UInt32 dirIterator = expIteratorStart;
|
||||
|
||||
desc.nameP = nameP;
|
||||
desc.nameBufLen = 256;
|
||||
e = VFSFileOpen(gVars->volRefNum, _path.c_str(), vfsModeRead, &handle);
|
||||
|
||||
if (e)
|
||||
return myList;
|
||||
|
||||
while(dirIterator != expIteratorStop) {
|
||||
e = VFSDirEntryEnumerate(handle, &dirIterator, &desc);
|
||||
if (!e) {
|
||||
addFile(myList, mode, _path.c_str(), &desc);
|
||||
}
|
||||
}
|
||||
|
||||
VFSFileClose(handle);
|
||||
|
||||
return myList;
|
||||
}
|
||||
|
||||
const char *lastPathComponent(const ScummVM::String &str) {
|
||||
const char *start = str.c_str();
|
||||
const char *cur = start + str.size() - 2;
|
||||
|
||||
while (cur > start && *cur != '/') {
|
||||
--cur;
|
||||
}
|
||||
|
||||
return cur+1;
|
||||
}
|
||||
|
||||
FilesystemNode *PalmOSFilesystemNode::parent() const {
|
||||
|
||||
PalmOSFilesystemNode *p = new PalmOSFilesystemNode();
|
||||
|
||||
if (!_isPseudoRoot) {
|
||||
const char *start = _path.c_str();
|
||||
const char *end = lastPathComponent(_path);
|
||||
|
||||
p->_path = String(start, end - start);
|
||||
p->_isValid = true;
|
||||
p->_isDirectory = true;
|
||||
p->_displayName = lastPathComponent(p->_path);
|
||||
p->_isPseudoRoot =(p->_path == "/");
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
#endif // __PALMOS_TRAPS__
|
Loading…
Reference in New Issue
Block a user