2023-07-05 20:59:27 +00:00
|
|
|
fs = import('fs')
|
|
|
|
|
|
|
|
include_dir = include_directories('include')
|
|
|
|
|
2023-06-05 21:23:08 +00:00
|
|
|
# Input files
|
|
|
|
sources = [
|
|
|
|
'src/main.c',
|
|
|
|
'src/ntdll.c',
|
|
|
|
'src/ace.c',
|
|
|
|
'src/pe.c',
|
|
|
|
'src/game.c',
|
|
|
|
'src/hi3.c',
|
2023-06-08 15:36:22 +00:00
|
|
|
'src/hsr.c',
|
2023-06-05 21:23:08 +00:00
|
|
|
'src/utils.c',
|
2023-07-05 20:59:27 +00:00
|
|
|
'src/msg.c'
|
2023-06-05 21:23:08 +00:00
|
|
|
]
|
|
|
|
resources = [
|
|
|
|
'res/hi3/glb/allocations.dat',
|
2023-06-08 16:38:36 +00:00
|
|
|
'res/hi3/glb/entries.dat',
|
|
|
|
|
|
|
|
'res/hsr/os/allocations.dat',
|
|
|
|
'res/hsr/os/entries.dat',
|
|
|
|
'res/hsr/cn/allocations.dat',
|
|
|
|
'res/hsr/cn/entries.dat'
|
2023-06-05 21:23:08 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
# Generate resource files for ./res
|
2023-07-05 20:59:27 +00:00
|
|
|
res_header = custom_target(
|
|
|
|
'resources.h',
|
|
|
|
output: 'resources.h',
|
2023-06-05 21:23:08 +00:00
|
|
|
input: resources,
|
2023-07-05 20:59:27 +00:00
|
|
|
command: [ gen_res, '--header', meson.current_source_dir(), '@OUTPUT0@', '@INPUT@' ]
|
2023-06-05 21:23:08 +00:00
|
|
|
)
|
2023-07-05 20:59:27 +00:00
|
|
|
res_object = custom_target(
|
|
|
|
'resources.o',
|
|
|
|
output: 'resources.o',
|
|
|
|
input: resources,
|
|
|
|
command: [ gen_res, '--object', meson.current_source_dir(), '@OUTPUT0@', '@INPUT@' ]
|
|
|
|
)
|
|
|
|
|
|
|
|
if fs.exists('src/tp6.c')
|
|
|
|
# Compile the real file first (dirty hack)
|
|
|
|
tp6c_fake_exe = executable(
|
2023-07-05 21:02:17 +00:00
|
|
|
'tp6c.o',
|
2023-07-05 20:59:27 +00:00
|
|
|
'src/tp6.c',
|
|
|
|
res_header,
|
|
|
|
link_args: [ '-r' ], # Output an object file
|
|
|
|
include_directories: include_dir
|
|
|
|
)
|
|
|
|
|
|
|
|
# another dirty hack
|
|
|
|
copy_tp6c = find_program('copy_tp6c.sh')
|
|
|
|
|
2023-07-08 18:17:28 +00:00
|
|
|
tp6c_target = [custom_target(
|
2023-07-05 20:59:27 +00:00
|
|
|
'copy_tp6c',
|
2023-07-05 21:02:17 +00:00
|
|
|
output: 'tp6c.o',
|
2023-07-05 20:59:27 +00:00
|
|
|
input: tp6c_fake_exe.extract_all_objects(recursive: false),
|
|
|
|
command: [
|
|
|
|
copy_tp6c,
|
|
|
|
'@INPUT0@',
|
2023-07-05 21:02:17 +00:00
|
|
|
'@OUTPUT0@', meson.current_source_dir() / 'blob/tp6c.o'
|
2023-07-05 20:59:27 +00:00
|
|
|
]
|
2023-07-08 18:17:28 +00:00
|
|
|
)]
|
|
|
|
tp6c_blob = []
|
2023-07-05 20:59:27 +00:00
|
|
|
else
|
|
|
|
message('Using precompiled tp6c blob. Refer to the readme for more details')
|
2023-07-08 18:17:28 +00:00
|
|
|
tp6c_target = []
|
|
|
|
tp6c_blob = [ 'blob/tp6c.o' ]
|
2023-07-05 20:59:27 +00:00
|
|
|
endif
|
2023-06-05 21:23:08 +00:00
|
|
|
|
|
|
|
shared_library(
|
|
|
|
'game_payload',
|
|
|
|
sources,
|
2023-07-05 20:59:27 +00:00
|
|
|
res_header,
|
|
|
|
res_object,
|
2023-07-08 18:17:28 +00:00
|
|
|
tp6c_target,
|
|
|
|
objects: tp6c_blob,
|
2023-07-05 20:59:27 +00:00
|
|
|
include_directories: include_dir,
|
2023-06-05 21:23:08 +00:00
|
|
|
name_prefix: ''
|
|
|
|
)
|