Skip to content

Commit

Permalink
fix builds
Browse files Browse the repository at this point in the history
  • Loading branch information
sauerbraten committed Jan 20, 2021
1 parent 15ca961 commit 4dbad0a
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 24 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ gzip-menus:

_include-menus:
sed -i "s/0,\/\/menuscrc/0x$(shell crc32 data/p1xbraten/menus.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/menuslen/$(shell stat --printf="%s" data/p1xbraten/menus.cfg.gz),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> menuscfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/menus.cfg.gz)> menuscfg/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/mastercrc/0x$(shell crc32 data/p1xbraten/master.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/masterlen/$(shell stat --printf="%s" data/p1xbraten/master.cfg.gz),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> mastercfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/master.cfg.gz)> mastercfg/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/gamehudcrc/0x$(shell crc32 data/p1xbraten/gamehud.cfg),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/0,\/\/gamehudlen/$(shell stat --printf="%s" data/p1xbraten/gamehud.cfg.gz),/" src/fpsgame/p1xbraten_menus.cpp
sed -i "s/embeddedfile<0> gamehudcfg/embeddedfile<$(shell stat --printf="%s" data/p1xbraten/gamehud.cfg.gz)> gamehudcfg/" src/fpsgame/p1xbraten_menus.cpp

clean-sauer: check-env
cd $(SAUER_DIR) && \
Expand Down
20 changes: 9 additions & 11 deletions patches/include_p1xbraten_menus.patch
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,37 @@ Index: src/fpsgame/p1xbraten_menus.cpp
===================================================================
--- src/fpsgame/p1xbraten_menus.cpp (nonexistent)
+++ src/fpsgame/p1xbraten_menus.cpp (working copy)
@@ -0,0 +1,81 @@
@@ -0,0 +1,79 @@
+#include "cube.h"
+#include "p1xbraten_menus.h"
+
+namespace game {
+ struct embeddedfile menuscfg = {
+ struct embeddedfile<0> menuscfg = {
+ "data/p1xbraten/menus.cfg.gz",
+ 0,//menuscrc
+ 0,//menuslen
+ {
+ #include "../../data/p1xbraten/menus.cfg.gz.xxd"
+ }
+ };
+
+ struct embeddedfile mastercfg = {
+ struct embeddedfile<0> mastercfg = {
+ "data/p1xbraten/master.cfg.gz",
+ 0,//mastercrc
+ 0,//masterlen
+ {
+ #include "../../data/p1xbraten/master.cfg.gz.xxd"
+ }
+ };
+
+ struct embeddedfile gamehudcfg = {
+ struct embeddedfile<0> gamehudcfg = {
+ "data/p1xbraten/gamehud.cfg.gz",
+ 0,//gamehudcrc
+ 0,//gamehudlen
+ {
+ #include "../../data/p1xbraten/gamehud.cfg.gz.xxd"
+ }
+ };
+
+ int update(embeddedfile *i)
+ template<size_t N>
+ int update(embeddedfile<N> *i)
+ {
+ stream *f = opengzfile(path(i->name), "rb");
+ if(f)
Expand All @@ -69,7 +67,7 @@ Index: src/fpsgame/p1xbraten_menus.cpp
+
+ f = openrawfile(path(i->name), "wb");
+ if(!f) return 2;
+ f->write(i->contents, i->len);
+ f->write(i->contents, N);
+ delete f;
+ conoutf("updated %s", i->name);
+ return 0;
Expand Down Expand Up @@ -115,11 +113,11 @@ Index: src/fpsgame/p1xbraten_menus.h
+#include "cube.h"
+
+namespace game {
+ template<size_t N>
+ struct embeddedfile {
+ string name;
+ const uint crc;
+ const size_t len;
+ const uchar contents[];
+ const uchar contents[N];
+ };
+}
\ No newline at end of file
Expand Down
14 changes: 6 additions & 8 deletions src/fpsgame/p1xbraten_menus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,32 @@
#include "p1xbraten_menus.h"

namespace game {
struct embeddedfile menuscfg = {
struct embeddedfile<16060> menuscfg = {
"data/p1xbraten/menus.cfg.gz",
0x1607c7ba,
16060,
{
#include "../../data/p1xbraten/menus.cfg.gz.xxd"
}
};

struct embeddedfile mastercfg = {
struct embeddedfile<1029> mastercfg = {
"data/p1xbraten/master.cfg.gz",
0xe6bf7248,
1029,
{
#include "../../data/p1xbraten/master.cfg.gz.xxd"
}
};

struct embeddedfile gamehudcfg = {
struct embeddedfile<222> gamehudcfg = {
"data/p1xbraten/gamehud.cfg.gz",
0xac5cc9fd,
222,
{
#include "../../data/p1xbraten/gamehud.cfg.gz.xxd"
}
};

int update(embeddedfile *i)
template<size_t N>
int update(embeddedfile<N> *i)
{
stream *f = opengzfile(path(i->name), "rb");
if(f)
Expand All @@ -41,7 +39,7 @@ namespace game {

f = openrawfile(path(i->name), "wb");
if(!f) return 2;
f->write(i->contents, i->len);
f->write(i->contents, N);
delete f;
conoutf("updated %s", i->name);
return 0;
Expand Down
4 changes: 2 additions & 2 deletions src/fpsgame/p1xbraten_menus.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#include "cube.h"

namespace game {
template<size_t N>
struct embeddedfile {
string name;
const uint crc;
const size_t len;
const uchar contents[];
const uchar contents[N];
};
}

0 comments on commit 4dbad0a

Please sign in to comment.