0
0
Fork 0
haikuports/games-kids/dragonmemory/patches/dragonmemory-1.patchset

123 lines
3.0 KiB
Plaintext

From 4ae6817669ec275f1f41b71731f3855011f8b4ce Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 25 Sep 2014 10:49:04 +0200
Subject: Fix path issues.
diff --git a/Makefile b/Makefile
index 1114af0..b1f9034 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
-CC = gcc -Wall -ansi
+CC = gcc -Wall -Wno-multichar
all:
- $(CC) dragonmemory.cpp -o dragonmemory -lGL -lGLU -lSDL_image -lSDL_mixer `sdl-config --cflags --libs`
+ $(CC) dragonmemory.cpp -o dragonmemory -lGL -lGLU -lSDL_image -lSDL_mixer `sdl-config --cflags --libs` -lbe
clean:
@echo Cleaning up...
diff --git a/dragonmemory.cpp b/dragonmemory.cpp
index 145dd8b..2fc7ac9 100644
--- a/dragonmemory.cpp
+++ b/dragonmemory.cpp
@@ -8,6 +8,8 @@
#include<stdlib.h>
#include<math.h>
#include<time.h>
+#include <libgen.h>
+#include <unistd.h>
#ifdef ANDROID
#include<SDL.h>
#include<SDL_image.h>
@@ -40,6 +42,7 @@
int main (int argc, char * argv[])
{
+ chdir(dirname(argv[0]));
initSDL();
initGL();
showIntro();
diff --git a/file.h b/file.h
index fdac20a..31369ae 100644
--- a/file.h
+++ b/file.h
@@ -1,11 +1,20 @@
+#include <Path.h>
+#include <PathFinder.h>
+
void loadScores()
{
int hiByte, loByte;
FILE *scores;
- scores = fopen(SAVEDIR "/hiscore.dat", "rb");
+
+ char buffer[1024];
+ buffer[0] = 0;
+ status_t x = find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, buffer, 1024);
+ strcat(buffer, "/DragonMemory.dat");
+
+ scores = fopen(buffer, "rb");
if(scores == NULL)
{
- scores = fopen(SAVEDIR "/hiscore.dat", "wb+");
+ scores = fopen(buffer, "wb+");
fputc(1 ,scores);
fputc(0, scores);
fputc(0 ,scores);
@@ -13,7 +22,7 @@ void loadScores()
fputc(0 ,scores);
fputc(0 ,scores);
fclose(scores);
- scores = fopen(SAVEDIR "/hiscore.dat", "rb");
+ scores = fopen(buffer, "rb");
}
maxLevel = fgetc(scores);
if(maxLevel == EOF)
@@ -47,7 +56,14 @@ void saveScore(int score, int time)
// 1 extra byte at the BEGINING of the file to store the last unlocked level
int maxSavedLevel, hiByte, loByte;
FILE *scores;
- scores = fopen(SAVEDIR "/hiscore.dat", "rb+");
+
+ char buffer[1024];
+ buffer[0] = 0;
+ status_t x = find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, buffer, 1024);
+ strcat(buffer, "/DragonMemory.dat");
+
+
+ scores = fopen(buffer, "rb+");
maxSavedLevel = fgetc(scores);
if(levelNumber + 1 > maxSavedLevel)
--
2.19.1
From 292a663a01b679cece83abf94504f881ac2f8171 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Mon, 18 Feb 2019 20:05:32 +0100
Subject: No need for -lGlu, fix make clean
diff --git a/Makefile b/Makefile
index b1f9034..207856c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,9 @@
CC = gcc -Wall -Wno-multichar
all:
- $(CC) dragonmemory.cpp -o dragonmemory -lGL -lGLU -lSDL_image -lSDL_mixer `sdl-config --cflags --libs` -lbe
+ $(CC) dragonmemory.cpp -o dragonmemory -lGL -lSDL_image -lSDL_mixer `sdl-config --cflags --libs` -lbe
clean:
@echo Cleaning up...
- @rm dragon
+ @rm dragonmemory
@echo Done.
--
2.19.1