FreeBSD Bugzilla – Attachment 250811 Details for
Bug 279161
games/sdlpop: fix data directory patch
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fix more datadir constants.
0001-games-sdlpop-Fix-data-dir-patching.patch (text/plain), 3.93 KB, created by
Viacheslav Chimishuk
on 2024-05-19 14:20:46 UTC
(
hide
)
Description:
Fix more datadir constants.
Filename:
MIME Type:
Creator:
Viacheslav Chimishuk
Created:
2024-05-19 14:20:46 UTC
Size:
3.93 KB
patch
obsolete
>From 0dace1ed8a0ef358fefbed6f182e51b739fef837 Mon Sep 17 00:00:00 2001 >From: Viacheslav Chimishuk <vchimishuk@yandex.ru> >Date: Sun, 19 May 2024 16:40:31 +0300 >Subject: [PATCH] games/sdlpop: Fix data dir patching. > >--- > games/sdlpop/Makefile | 1 + > games/sdlpop/files/patch-lighting.c | 11 +++++++++++ > games/sdlpop/files/patch-seg009.c | 25 +++++++++++++++++-------- > 3 files changed, 29 insertions(+), 8 deletions(-) > create mode 100644 games/sdlpop/files/patch-lighting.c > >diff --git a/games/sdlpop/Makefile b/games/sdlpop/Makefile >index 618c03814f..141f158246 100644 >--- a/games/sdlpop/Makefile >+++ b/games/sdlpop/Makefile >@@ -31,6 +31,7 @@ DESKTOP_ENTRIES= "Prince" "Open-Source port of Prince of Persia" \ > OPTIONS_DEFINE= DOCS > > post-patch: >+ @${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' ${WRKSRC}/lighting.c > @${REINPLACE_CMD} -e 's|%%DATADIR%%|${DATADIR}|' ${WRKSRC}/seg009.c > > do-install: >diff --git a/games/sdlpop/files/patch-lighting.c b/games/sdlpop/files/patch-lighting.c >new file mode 100644 >index 0000000000..b2401c77c8 >--- /dev/null >+++ b/games/sdlpop/files/patch-lighting.c >@@ -0,0 +1,11 @@ >+--- lighting.c.orig 2024-05-19 13:09:17 UTC >++++ lighting.c >+@@ -25,7 +25,7 @@ Uint32 bgcolor; >+ image_type* screen_overlay = NULL; >+ Uint32 bgcolor; >+ >+-const char mask_filename[] = "data/light.png"; >++const char mask_filename[] = "%%DATADIR%%/light.png"; >+ const Uint8 ambient_level = 128; >+ >+ // Called once at startup. >diff --git a/games/sdlpop/files/patch-seg009.c b/games/sdlpop/files/patch-seg009.c >index 1c6c504014..460c6df3b6 100644 >--- a/games/sdlpop/files/patch-seg009.c >+++ b/games/sdlpop/files/patch-seg009.c >@@ -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 >-@@ -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 (fp == NULL) { > char data_path[POP_MAX_PATH]; > - snprintf_check(data_path, sizeof(data_path), "data/%s", filename); > + snprintf_check(data_path, sizeof(data_path), "%%DATADIR%%/%s", filename); > >- if (!file_exists(data_path)) { >- find_exe_dir(); >-@@ -2078,7 +2078,7 @@ const int sound_channel = 0; >+ if (!file_exists(data_path)) { >+ find_exe_dir(); >+@@ -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; > > void load_sound_names() { >@@ -18,7 +27,7 @@ > if (sound_names != NULL) return; > FILE* fp = fopen(names_path,"rt"); > 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"); > } > if (fp == NULL && !skip_normal_data_files) { >@@ -27,7 +36,7 @@ > fp = fopen(locate_file(filename), "rb"); > } > 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 > } > >@@ -36,7 +45,7 @@ > if (icon == NULL) { > sdlperror("set_gr_mode: Could not load icon"); > } 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] == '.') { > filename_no_ext[len-4] = '\0'; // terminate, so ".DAT" is deleted from the filename > } >-- >2.44.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 279161
: 250811