FireBirdLib - Topfield TMS PVR TAP Programming Library
HDD_SetExtRecording.c
Go to the documentation of this file.
1
#include <stdlib.h>
2
#include <string.h>
3
#include "
libFireBird.h
"
4
5
//This function returns 0x0000 on success
6
// 0xe00* for warnings
7
// and 0xf00* for errors
8
word
HDD_SetExtRecording
(
bool
ExtDisk)
9
{
10
TRACEENTER
();
11
12
dword *__nExtPartition;
13
textPartitionInfo
*__extPartitionInfo;
14
dword *__extTsFolder;
15
byte
*__isAllPartitionInvalid;
16
int
*__selectedPartition;
17
tDirEntry
*
DirEntry
;
18
char
*ExtDiskPart;
19
20
void (*
Appl_SetIsExternal
)(
bool
) = NULL;
21
22
//Resolve all firmware functions and variables
23
__nExtPartition = (dword*)
FIS_vnExtPartition
();
24
if
(!__nExtPartition)
25
{
26
TRACEEXIT
();
27
return
0xf000;
28
}
29
30
Appl_SetIsExternal
= (
void
*)
FIS_fwAppl_SetIsExternal
();
31
if
(!
Appl_SetIsExternal
)
32
{
33
TRACEEXIT
();
34
return
0xf001;
35
}
36
37
__extPartitionInfo = (
textPartitionInfo
*)
FIS_vExtPartitionInfo
();
38
if
(!__extPartitionInfo)
39
{
40
TRACEEXIT
();
41
return
0xf002;
42
}
43
44
__extTsFolder = (dword*)
FIS_vExtTsFolder
();
45
if
(!__extTsFolder)
46
{
47
TRACEEXIT
();
48
return
0xf003;
49
}
50
51
__isAllPartitionInvalid = (
byte
*)
FIS_vIsAllPartitionInvalid
();
52
if
(!__isAllPartitionInvalid)
53
{
54
TRACEEXIT
();
55
return
0xf004;
56
}
57
58
__selectedPartition = (
int
*)
FIS_vSelectedPartition
();
59
if
(!__selectedPartition)
60
{
61
TRACEEXIT
();
62
return
0xf005;
63
}
64
65
if
(ExtDisk)
66
{
67
//Check if an external disk has been mounted
68
if
(*__nExtPartition == 0)
69
{
70
TRACEEXIT
();
71
return
0xe000;
72
}
73
74
//Check if there is at least one partition which can be used for recording
75
if
(*__isAllPartitionInvalid != 0)
76
{
77
TRACEEXIT
();
78
return
0xe001;
79
}
80
81
//Another check to make sure that there is a selectable partition
82
if
(__selectedPartition[1] < 0)
83
{
84
TRACEEXIT
();
85
return
0xe002;
86
}
87
88
//Get the first partition of that drive
89
ExtDiskPart = __extPartitionInfo[__selectedPartition[1]].
MountPath
;
90
91
//Build the DirEntry struct
92
DirEntry
= TAP_MemAlloc(
sizeof
(
tDirEntry
));
93
if
(!
DirEntry
)
94
{
95
TRACEEXIT
();
96
return
0xf006;
97
}
98
99
DirEntry
->Magic = 0xbacaed31;
100
DirEntry
->Path = TAP_MemAlloc(strlen(ExtDiskPart) + 1);
101
if
(!
DirEntry
->Path)
102
{
103
TRACEEXIT
();
104
return
0xf007;
105
}
106
107
memset(
DirEntry
->Path, 0, strlen(ExtDiskPart) + 1);
108
strcpy(
DirEntry
->Path, ExtDiskPart);
109
DirEntry
->unknown1 = 9;
110
DirEntry
->unknown2 = 16;
111
112
//Let the extTsFolder point to our DirEnt structure
113
*__extTsFolder = (dword)
DirEntry
;
114
115
//Set the external disk usage flag
116
Appl_SetIsExternal
(TRUE);
117
}
118
else
119
{
120
Appl_SetIsExternal
(FALSE);
121
}
122
123
TRACEEXIT
();
124
return
0x0000;
125
}
Appl_SetIsExternal
void Appl_SetIsExternal(bool External)
Definition:
Appl_SetIsExternal.c:3
bool
#define bool
Definition:
ELF.h:26
FIS_fwAppl_SetIsExternal
dword FIS_fwAppl_SetIsExternal(void)
Definition:
FIS_fwAppl_SetIsExternal.c:3
FIS_vExtPartitionInfo
dword FIS_vExtPartitionInfo(void)
Definition:
FIS_vextPartitionInfo.c:3
FIS_vExtTsFolder
dword FIS_vExtTsFolder(void)
Definition:
FIS_vextTsFolder.c:3
FIS_vIsAllPartitionInvalid
dword FIS_vIsAllPartitionInvalid(void)
Definition:
FIS_visAllPartitionInvalid.c:3
FIS_vnExtPartition
dword FIS_vnExtPartition(void)
Definition:
FIS_vnExtPartition.c:3
FIS_vSelectedPartition
dword FIS_vSelectedPartition(void)
Definition:
FIS_vselectedPartition.c:3
HDD_SetExtRecording
word HDD_SetExtRecording(bool ExtDisk)
Definition:
HDD_SetExtRecording.c:8
libFireBird.h
TRACEEXIT
#define TRACEEXIT()
Definition:
libFireBird.h:1244
TRACEENTER
#define TRACEENTER()
Definition:
libFireBird.h:1243
DirEntry
Definition:
FBLib_hdd.h:65
tDirEntry
Definition:
libFireBird.h:1445
textPartitionInfo
Definition:
libFireBird.h:1912
textPartitionInfo::MountPath
char MountPath[10]
Definition:
libFireBird.h:1914
rec
HDD_SetExtRecording.c
Generated on Fri Apr 29 2022 13:34:01 for FireBirdLib - Topfield TMS PVR TAP Programming Library by
1.9.3