games/sdlpop: fix data directory patch
After installing games/sdlpop from ports game cannot find its resources and shows next banner after start.
```
Cannot find a required data file:
IBM_SND1.DAT or folder:
data/IBM_SND1
Press any key to quit.
```
Proposed fix updates existing `files/patch-seg009.c` patch to fix the issue.
PR: 279161
This commit is contained in:
parent
8b0178e10c
commit
37544c8ef6
@ -1,6 +1,7 @@
|
|||||||
PORTNAME= sdlpop
|
PORTNAME= sdlpop
|
||||||
DISTVERSIONPREFIX= v
|
DISTVERSIONPREFIX= v
|
||||||
DISTVERSION= 1.23
|
DISTVERSION= 1.23
|
||||||
|
PORTREVISION= 1
|
||||||
CATEGORIES= games
|
CATEGORIES= games
|
||||||
|
|
||||||
MAINTAINER= pkubaj@FreeBSD.org
|
MAINTAINER= pkubaj@FreeBSD.org
|
||||||
@ -31,6 +32,7 @@ DESKTOP_ENTRIES= "Prince" "Open-Source port of Prince of Persia" \
|
|||||||
OPTIONS_DEFINE= DOCS
|
OPTIONS_DEFINE= DOCS
|
||||||
|
|
||||||
post-patch:
|
post-patch:
|
||||||
|
@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' ${WRKSRC}/lighting.c
|
||||||
@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' ${WRKSRC}/seg009.c
|
@${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' ${WRKSRC}/seg009.c
|
||||||
|
|
||||||
do-install:
|
do-install:
|
||||||
|
|||||||
@ -1,15 +1,24 @@
|
|||||||
--- seg009.c.orig 2021-07-06 13:10:16 UTC
|
--- seg009.c.orig 2023-02-04 09:43:22 UTC
|
||||||
+++ seg009.c
|
+++ seg009.c
|
||||||
@@ -343,7 +343,7 @@ static FILE* open_dat_from_root_or_data_dir(const char
|
@@ -340,7 +340,7 @@ static FILE* open_dat_from_root_or_data_dir(const char
|
||||||
// if failed, try if the DAT file can be opened in the data/ directory, instead of the main folder
|
// if failed, try if the DAT file can be opened in the data/ directory, instead of the main folder
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
char data_path[POP_MAX_PATH];
|
char data_path[POP_MAX_PATH];
|
||||||
- snprintf_check(data_path, sizeof(data_path), "data/%s", filename);
|
- snprintf_check(data_path, sizeof(data_path), "data/%s", filename);
|
||||||
+ snprintf_check(data_path, sizeof(data_path), "%%DATADIR%%/%s", filename);
|
+ snprintf_check(data_path, sizeof(data_path), "%%DATADIR%%/%s", filename);
|
||||||
|
|
||||||
if (!file_exists(data_path)) {
|
if (!file_exists(data_path)) {
|
||||||
find_exe_dir();
|
find_exe_dir();
|
||||||
@@ -2078,7 +2078,7 @@ const int sound_channel = 0;
|
@@ -411,7 +411,7 @@ dat_type* open_dat(const char* filename, int optional)
|
||||||
|
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename
|
||||||
|
}
|
||||||
|
char foldername[POP_MAX_PATH];
|
||||||
|
- snprintf_check(foldername,sizeof(foldername),"data/%s",filename_no_ext);
|
||||||
|
+ snprintf_check(foldername,sizeof(foldername),"%%DATADIR%%/%s",filename_no_ext);
|
||||||
|
const char* data_path = locate_file(foldername);
|
||||||
|
struct stat path_stat;
|
||||||
|
int result = stat(data_path, &path_stat);
|
||||||
|
@@ -2120,7 +2120,7 @@ void load_sound_names() {
|
||||||
const int max_sound_id = 58;
|
const int max_sound_id = 58;
|
||||||
|
|
||||||
void load_sound_names() {
|
void load_sound_names() {
|
||||||
@ -18,7 +27,7 @@
|
|||||||
if (sound_names != NULL) return;
|
if (sound_names != NULL) return;
|
||||||
FILE* fp = fopen(names_path,"rt");
|
FILE* fp = fopen(names_path,"rt");
|
||||||
if (fp==NULL) return;
|
if (fp==NULL) return;
|
||||||
@@ -2128,7 +2128,7 @@ sound_buffer_type* load_sound(int index) {
|
@@ -2170,7 +2170,7 @@ sound_buffer_type* load_sound(int index) {
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
}
|
}
|
||||||
if (fp == NULL && !skip_normal_data_files) {
|
if (fp == NULL && !skip_normal_data_files) {
|
||||||
@ -27,7 +36,7 @@
|
|||||||
fp = fopen(locate_file(filename), "rb");
|
fp = fopen(locate_file(filename), "rb");
|
||||||
}
|
}
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
@@ -2495,7 +2495,7 @@ void __pascal far set_gr_mode(byte grmode) {
|
@@ -2546,7 +2546,7 @@ void set_gr_mode(byte grmode) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +45,7 @@
|
|||||||
if (icon == NULL) {
|
if (icon == NULL) {
|
||||||
sdlperror("set_gr_mode: Could not load icon");
|
sdlperror("set_gr_mode: Could not load icon");
|
||||||
} else {
|
} else {
|
||||||
@@ -2754,7 +2754,7 @@ void load_from_opendats_metadata(int resource_id, cons
|
@@ -2814,7 +2814,7 @@ void load_from_opendats_metadata(int resource_id, cons
|
||||||
if (len >= 5 && filename_no_ext[len-4] == '.') {
|
if (len >= 5 && filename_no_ext[len-4] == '.') {
|
||||||
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename
|
filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user