Lines 1-15
Link Here
|
1 |
--- seg009.c.orig 2021-07-06 13:10:16 UTC |
1 |
--- seg009.c.orig 2023-02-04 09:43:22 UTC |
2 |
+++ seg009.c |
2 |
+++ seg009.c |
3 |
@@ -343,7 +343,7 @@ static FILE* open_dat_from_root_or_data_dir(const char |
3 |
@@ -340,7 +340,7 @@ static FILE* open_dat_from_root_or_data_dir(const char |
4 |
// if failed, try if the DAT file can be opened in the data/ directory, instead of the main folder |
4 |
// if failed, try if the DAT file can be opened in the data/ directory, instead of the main folder |
5 |
if (fp == NULL) { |
5 |
if (fp == NULL) { |
6 |
char data_path[POP_MAX_PATH]; |
6 |
char data_path[POP_MAX_PATH]; |
7 |
- snprintf_check(data_path, sizeof(data_path), "data/%s", filename); |
7 |
- snprintf_check(data_path, sizeof(data_path), "data/%s", filename); |
8 |
+ snprintf_check(data_path, sizeof(data_path), "%%DATADIR%%/%s", filename); |
8 |
+ snprintf_check(data_path, sizeof(data_path), "%%DATADIR%%/%s", filename); |
9 |
|
9 |
|
10 |
if (!file_exists(data_path)) { |
10 |
if (!file_exists(data_path)) { |
11 |
find_exe_dir(); |
11 |
find_exe_dir(); |
12 |
@@ -2078,7 +2078,7 @@ const int sound_channel = 0; |
12 |
@@ -411,7 +411,7 @@ dat_type* open_dat(const char* filename, int optional) |
|
|
13 |
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename |
14 |
} |
15 |
char foldername[POP_MAX_PATH]; |
16 |
- snprintf_check(foldername,sizeof(foldername),"data/%s",filename_no_ext); |
17 |
+ snprintf_check(foldername,sizeof(foldername),"%%DATADIR%%/%s",filename_no_ext); |
18 |
const char* data_path = locate_file(foldername); |
19 |
struct stat path_stat; |
20 |
int result = stat(data_path, &path_stat); |
21 |
@@ -2120,7 +2120,7 @@ void load_sound_names() { |
13 |
const int max_sound_id = 58; |
22 |
const int max_sound_id = 58; |
14 |
|
23 |
|
15 |
void load_sound_names() { |
24 |
void load_sound_names() { |
Lines 18-24
Link Here
|
18 |
if (sound_names != NULL) return; |
27 |
if (sound_names != NULL) return; |
19 |
FILE* fp = fopen(names_path,"rt"); |
28 |
FILE* fp = fopen(names_path,"rt"); |
20 |
if (fp==NULL) return; |
29 |
if (fp==NULL) return; |
21 |
@@ -2128,7 +2128,7 @@ sound_buffer_type* load_sound(int index) { |
30 |
@@ -2170,7 +2170,7 @@ sound_buffer_type* load_sound(int index) { |
22 |
fp = fopen(filename, "rb"); |
31 |
fp = fopen(filename, "rb"); |
23 |
} |
32 |
} |
24 |
if (fp == NULL && !skip_normal_data_files) { |
33 |
if (fp == NULL && !skip_normal_data_files) { |
Lines 27-33
Link Here
|
27 |
fp = fopen(locate_file(filename), "rb"); |
36 |
fp = fopen(locate_file(filename), "rb"); |
28 |
} |
37 |
} |
29 |
if (fp == NULL) { |
38 |
if (fp == NULL) { |
30 |
@@ -2495,7 +2495,7 @@ void __pascal far set_gr_mode(byte grmode) { |
39 |
@@ -2546,7 +2546,7 @@ void set_gr_mode(byte grmode) { |
31 |
#endif |
40 |
#endif |
32 |
} |
41 |
} |
33 |
|
42 |
|
Lines 36-42
Link Here
|
36 |
if (icon == NULL) { |
45 |
if (icon == NULL) { |
37 |
sdlperror("set_gr_mode: Could not load icon"); |
46 |
sdlperror("set_gr_mode: Could not load icon"); |
38 |
} else { |
47 |
} else { |
39 |
@@ -2754,7 +2754,7 @@ void load_from_opendats_metadata(int resource_id, cons |
48 |
@@ -2814,7 +2814,7 @@ void load_from_opendats_metadata(int resource_id, cons |
40 |
if (len >= 5 && filename_no_ext[len-4] == '.') { |
49 |
if (len >= 5 && filename_no_ext[len-4] == '.') { |
41 |
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename |
50 |
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename |
42 |
} |
51 |
} |
43 |
- |
|
|