Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
877c78509d | 1 year ago |
|
2672b953a3 | 1 year ago |
13 changed files with 257 additions and 87 deletions
@ -0,0 +1,65 @@
|
||||
PROG = blobwarsAttrition |
||||
CC = gcc |
||||
PREFIX ?= /usr |
||||
BIN_DIR ?= $(PREFIX)/bin |
||||
DATA_DIR ?= data |
||||
LOCALE_DIR = locale |
||||
ICON_DIR = $(PREFIX)/share/icons/hicolor |
||||
DESKTOP_DIR = $(PREFIX)/share/applications |
||||
|
||||
DESTDIR ?= |
||||
INST_BIN_DIR = $(DESTDIR)$(BIN_DIR) |
||||
INST_DATA_DIR = $(DESTDIR)$(DATA_DIR) |
||||
INST_LOCALE_DIR = $(DESTDIR)$(LOCALE_DIR) |
||||
INST_ICON_DIR = $(DESTDIR)$(ICON_DIR) |
||||
INST_DESKTOP_DIR = $(DESTDIR)$(DESKTOP_DIR) |
||||
|
||||
SEARCHPATH += src/plat/mos |
||||
_OBJS += mosInit.o |
||||
|
||||
include common.mk |
||||
|
||||
CXXFLAGS += -O3 -DVERSION=$(VERSION) -DREVISION=$(REVISION) -DDATA_DIR=\"$(DATA_DIR)\" -DLOCALE_DIR=\"$(LOCALE_DIR)\" -D__USE_INLINE__ |
||||
CXXFLAGS += -I/sdk/gg/usr/local/include -g -lefence |
||||
CXXFLAGS += -fms-extensions -std=gnu11 -noixemul |
||||
ifneq ("$(wildcard .errors)","") |
||||
CXXFLAGS += -Wall -Wempty-body -Werror -Wstrict-prototypes -Werror=maybe-uninitialized -Warray-bounds |
||||
endif |
||||
|
||||
LDFLAGS += -noixemul -lSDL2_image -lSDL2_ttf -lfreetype -ltiff -lpng16 -ljpeg -lz -lm |
||||
LDFLAGS += -lSDL2_mixer -lmikmod -lmodplug -lFLAC -lvorbisfile -lvorbis -logg |
||||
LDFLAGS += -lSDL2 -lstdc++ |
||||
|
||||
SHARED_FILES = LICENSE README.md data gfx manual music sound icons |
||||
DIST_FILES = $(SHARED_FILES) locale $(PROG) |
||||
SRC_DIST_FILES = $(SHARED_FILES) src makefile* common.mk |
||||
|
||||
# linking the program. |
||||
$(PROG): $(OBJS) |
||||
$(CC) -o $@ $(OBJS) $(LDFLAGS) |
||||
|
||||
# prepare an archive for the program |
||||
dist: |
||||
mkdir -p release/$(PROG)-$(VERSION).$(REVISION) |
||||
cp $(PROG) release/$(PROG)-$(VERSION).$(REVISION)/ |
||||
strip release/$(PROG)-$(VERSION).$(REVISION)/$(PROG) |
||||
cp icons/blob.info release/$(PROG)-$(VERSION).$(REVISION)/$(PROG).info |
||||
cp LICENSE release/$(PROG)-$(VERSION).$(REVISION)/ |
||||
cp README.md release/$(PROG)-$(VERSION).$(REVISION)/ |
||||
cp README-Amiga.md release/$(PROG)-$(VERSION).$(REVISION)/ |
||||
lha -aeqr3 a $(PROG)-MOS-$(VERSION).$(REVISION).lha release/ |
||||
|
||||
|
||||
# prepare an archive for the program |
||||
src-dist: |
||||
$(RM) -rf $(PROG)-$(VERSION).$(REVISION) |
||||
mkdir $(PROG)-$(VERSION).$(REVISION) |
||||
cp -rL $(SRC_DIST_FILES) $(PROG)-$(VERSION).$(REVISION) |
||||
git log --pretty=format:"%h%x09%an%x09%ad%x09%s" --date=short >$(PROG)-$(VERSION).$(REVISION)/CHANGELOG.raw |
||||
tar czf $(PROG)-$(VERSION).$(REVISION).src.tar.gz $(PROG)-$(VERSION).$(REVISION) |
||||
mkdir -p dist |
||||
mv $(PROG)-$(VERSION).$(REVISION).src.tar.gz dist |
||||
$(RM) -rf $(PROG)-$(VERSION).$(REVISION) |
||||
|
||||
.PHONY: dist |
||||
|
@ -0,0 +1,101 @@
|
||||
/*
|
||||
Copyright (C) 2018-2019 Parallel Realities |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
||||
*/ |
||||
|
||||
#include <proto/dos.h> |
||||
#include <proto/exec.h> |
||||
|
||||
#include "mosInit.h" |
||||
|
||||
#define VSTRING "Blob Wars Attrition 1.2.2r2 (19.09.2022)" |
||||
#define VERSTAG "\0$VER: " VSTRING |
||||
unsigned long __stack = 1000000; |
||||
UBYTE VString[] = VERSTAG; |
||||
|
||||
static void mkpath(const char *path); |
||||
|
||||
void createSaveFolder(void) |
||||
{ |
||||
char *dir; |
||||
int i; |
||||
|
||||
BPTR savesPathLock = Lock("PROGDIR:saves", SHARED_LOCK); |
||||
if (!savesPathLock) |
||||
{ |
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, "Saves folder not found. I am going to create it."); |
||||
mkpath("PROGDIR:saves"); |
||||
} |
||||
else { |
||||
UnLock(savesPathLock); |
||||
} |
||||
|
||||
for (i = 0 ; i < MAX_SAVE_SLOTS ; i++) |
||||
{ |
||||
dir = buildFormattedString("saves/%d", i); |
||||
|
||||
mkpath(dir); |
||||
|
||||
free(dir); |
||||
} |
||||
app.saveDir = "saves"; |
||||
} |
||||
|
||||
static void mkpath(const char *path) |
||||
{ |
||||
char dir[MAX_FILENAME_LENGTH]; |
||||
int i, rootPath; |
||||
|
||||
strcpy(dir, ""); |
||||
|
||||
rootPath = 1; |
||||
|
||||
for (i = 0 ; i < strlen(path) ; i++) |
||||
{ |
||||
if (path[i] == '/') |
||||
{ |
||||
if (!rootPath) |
||||
{ |
||||
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0 && errno != EEXIST) |
||||
{ |
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Failed to create save dir '%s'.", dir); |
||||
exit(1); |
||||
} |
||||
} |
||||
|
||||
rootPath = 0; |
||||
} |
||||
|
||||
dir[i] = path[i]; |
||||
dir[i + 1] = '\0'; |
||||
} |
||||
|
||||
if (mkdir(dir, S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH) != 0 && errno != EEXIST) |
||||
{ |
||||
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "Failed to create save dir '%s'.", dir); |
||||
exit(1); |
||||
} |
||||
} |
||||
|
||||
void createScreenshotFolder(void) |
||||
{ |
||||
mkdir("PROGDIR:screenshots", S_IRWXU|S_IRWXG|S_IROTH|S_IXOTH); |
||||
|
||||
dev.screenshotFolder = "screenshots"; |
||||
} |
||||
|
@ -0,0 +1,32 @@
|
||||
/*
|
||||
Copyright (C) 2018-2019 Parallel Realities |
||||
|
||||
This program is free software; you can redistribute it and/or |
||||
modify it under the terms of the GNU General Public License |
||||
as published by the Free Software Foundation; either version 2 |
||||
of the License, or (at your option) any later version. |
||||
|
||||
This program is distributed in the hope that it will be useful, |
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
|
||||
See the GNU General Public License for more details. |
||||
|
||||
You should have received a copy of the GNU General Public License |
||||
along with this program; if not, write to the Free Software |
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
||||
|
||||
*/ |
||||
|
||||
#include <sys/stat.h> |
||||
#include <pwd.h> |
||||
#include <unistd.h> |
||||
#include <errno.h> |
||||
|
||||
#include "../../common.h" |
||||
|
||||
extern char *buildFormattedString(const char *format, ...); |
||||
|
||||
extern App app; |
||||
extern Dev dev; |
||||
|
Loading…
Reference in new issue