Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0b3f90ab
Commit
0b3f90ab
authored
Feb 11, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 13, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winebuild: Use .incbin instead of printf for resource data.
parent
69ea31ff
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
25 deletions
+8
-25
res32.c
tools/winebuild/res32.c
+8
-25
No files found.
tools/winebuild/res32.c
View file @
0b3f90ab
...
...
@@ -44,6 +44,8 @@ struct resource
{
struct
string_id
type
;
struct
string_id
name
;
const
char
*
input_name
;
unsigned
int
input_offset
;
const
void
*
data
;
unsigned
int
data_size
;
unsigned
int
data_offset
;
...
...
@@ -156,28 +158,6 @@ static void put_string( const struct string_id *str )
}
}
static
void
dump_res_data
(
const
struct
resource
*
res
)
{
unsigned
int
i
=
0
;
unsigned
int
size
=
(
res
->
data_size
+
3
)
&
~
3
;
if
(
!
size
)
return
;
input_buffer
=
res
->
data
;
input_buffer_pos
=
0
;
input_buffer_size
=
size
;
output
(
"
\t
.long "
);
while
(
size
>
4
)
{
if
((
i
++
%
16
)
==
15
)
output
(
"0x%08x
\n\t
.long "
,
get_dword
()
);
else
output
(
"0x%08x,"
,
get_dword
()
);
size
-=
4
;
}
output
(
"0x%08x
\n
"
,
get_dword
()
);
assert
(
input_buffer_pos
==
input_buffer_size
);
}
/* check the file header */
/* all values must be zero except header size */
static
int
check_header
(
void
)
...
...
@@ -199,7 +179,7 @@ static int check_header(void)
}
/* load the next resource from the current file */
static
void
load_next_resource
(
DLLSPEC
*
spec
)
static
void
load_next_resource
(
DLLSPEC
*
spec
,
const
char
*
name
)
{
unsigned
int
hdr_size
;
struct
resource
*
res
=
add_resource
(
spec
);
...
...
@@ -209,6 +189,9 @@ static void load_next_resource( DLLSPEC *spec )
if
(
hdr_size
&
3
)
fatal_error
(
"%s header size not aligned
\n
"
,
input_buffer_filename
);
if
(
hdr_size
<
32
)
fatal_error
(
"%s invalid header size %u
\n
"
,
input_buffer_filename
,
hdr_size
);
res
->
input_name
=
xstrdup
(
name
);
res
->
input_offset
=
input_buffer_pos
-
2
*
sizeof
(
unsigned
int
)
+
hdr_size
;
res
->
data
=
input_buffer
+
input_buffer_pos
-
2
*
sizeof
(
unsigned
int
)
+
hdr_size
;
if
((
const
unsigned
char
*
)
res
->
data
<
input_buffer
||
(
const
unsigned
char
*
)
res
->
data
>=
input_buffer
+
input_buffer_size
)
...
...
@@ -237,7 +220,7 @@ int load_res32_file( const char *name, DLLSPEC *spec )
if
((
ret
=
check_header
()))
{
while
(
input_buffer_pos
<
input_buffer_size
)
load_next_resource
(
spec
);
while
(
input_buffer_pos
<
input_buffer_size
)
load_next_resource
(
spec
,
name
);
}
return
ret
;
}
...
...
@@ -490,7 +473,7 @@ void output_resources( DLLSPEC *spec )
{
output
(
"
\n\t
.align %d
\n
"
,
get_alignment
(
4
)
);
output
(
".L__wine_spec_res_%d:
\n
"
,
i
);
dump_res_data
(
res
);
output
(
"
\t
.incbin
\"
%s
\"
,%d,%d
\n
"
,
res
->
input_name
,
res
->
input_offset
,
res
->
data_size
);
}
if
(
!
is_pe
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment