NXEngine: various fixes (#3179)

This commit is contained in:
EXL
2018-10-02 21:43:33 +07:00
committed by Sergei Reznikov
parent 68a68052b4
commit 999536edd5
5 changed files with 165 additions and 129 deletions

View File

@@ -0,0 +1,8 @@
#!/bin/bash
if [[ `locale -l` == ru* ]] ;
then
EXE="`finddir B_SYSTEM_APPS_DIRECTORY`/NXEngine/RUS/nx-rus"
else
EXE="`finddir B_SYSTEM_APPS_DIRECTORY`/NXEngine/ENG/nx"
fi
$EXE $@

View File

@@ -0,0 +1,63 @@
resource app_flags B_SINGLE_LAUNCH;
resource app_version {
major = @MAJOR@,
middle = @MIDDLE@,
minor = @MINOR@,
variety = B_APPV_FINAL,
internal = 0,
short_info = "NXEngine",
long_info = "@LONG_INFO@"
};
resource app_signature "@APP_SIGNATURE@";
resource vector_icon array {
$"6E6369660803A9BDC503A9824A03DAEFDE030110010394A7AD038A9DA0032946"
$"560501020A20284E284C264C262C282C282A5A2A5A2C5C2C5C2E5E2E5E4C5C4C"
$"5C4E5A4E5A5058505854565456564A564A4E3E4E3E523C523C543A543A562E56"
$"2E523052304E0A043030305050505030390A0701001001158402040A00010102"
$"40C000000000000000400000C78000C3FFFF0A010101023A0000000000000000"
$"400000470000C400000A010101023A00000000000000004000004A8000C40000"
$"0A020101023C00000000000000003C000046000048C0000A020101023C000000"
$"00000000003C00004A400048C0000A020101023800000000000000003A00004A"
$"50004940000A020101023800000000000000003A00004AF0004940000A020101"
$"023800000000000000003A00004640004940000A020101023800000000000000"
$"003A00004860004940000A020101023800000000000000003A000047400048C0"
$"000A020101023800000000000000003A00004A900048C0000A03010102380000"
$"0000000000003BFFFF47400048C0000A030101023800000000000000003BFFFF"
$"4A900048C0000A030101023C000000000000000037FFFF4A3FFF48A0000A0301"
$"01023C000000000000000037FFFF45FFFF48A0000A0301010238000000000000"
$"000037FFFF463FFF48E0000A0301010238000000000000000037FFFF485FFF48"
$"E0000A0301010238000000000000000037FFFF4A4FFF48E0000A030101023800"
$"0000000000000037FFFF4AEFFF48E0000A030101023E80000000000000003A00"
$"00467FFF4A20000A030101023E0000000000000000380000477FFF4A70000A05"
$"01010238000000000000000038000046400048A0000A05010102380000000000"
$"00000038000048600048A0000A050101023800000000000000003800004A5000"
$"48A0000A050101023800000000000000003800004AF00048A0000A0401010238"
$"00000000000000003800004AD00048E0000A0401010238000000000000000038"
$"00004A700048E0000A0401010238000000000000000038000048200048E0000A"
$"0401010238000000000000000038000046C00048E0000A040101023800000000"
$"000000003800004640004740000A050101023800000000000000003800004580"
$"0046C0000A060101023800000000000000003800004480004A90000A06010102"
$"3800000000000000003800004B30004A90000A06010102380000000000000000"
$"3800004B30004640000A0001010238000000000000000038000047C00048E000"
$"0A000101023800000000000000003800004AB00048E0000A0601010238000000"
$"00000000003F80004580000822220A06010102408000000000000000380000C6"
$"800046C0000A020101023800000000000000003FC000448000C300000A020101"
$"023800000000000000003FC0004B3000C300000A0201010240C0000000000000"
$"00B80000C780004740000A0601010240C000000000000000B80000C780004AF0"
$"000A060101023D8000000000000000BA00004640004B40000A060101023C0000"
$"000000000000B800004800004B50000A060101023D0000000000000000B80000"
$"4600004B70000A060101023D0000000000000000BC80004A40004BB0000A0601"
$"0102380000000000000000C0A0004B50004C48000A0601010238000000000000"
$"0000C060004B70004C18000A06010102380000000000000000C020004B90004B"
$"F0000A06010102380000000000000000BFC0004BB0004BB0000A020101023C00"
$"00000000000000B8000044FFFF4AD0000A000101023C0000000000000000B800"
$"004680004B50000A000101023C8000000000000000B800004A50004B50000A02"
$"0101023C8000000000000000B800004A50004AD0000A01010102380000000000"
$"0000003DC0004B900047E0000A030101023800000000000000003E5FFF4B7000"
$"46E000"
};

View File

@@ -1,61 +0,0 @@
SUMMARY="An open-source rewrite engine of the Cave Story"
DESCRIPTION="The platform-adventure game focuses on an amnesiac protagonist \
who awakens in a cave. Through his explorations, he discovers a plot by the \
Doctor, a megalomaniac who intends to force the inhabitants of the cave to \
fight for him in his bid to conquer the world. The protagonist is thrust \
into the position of savior as he endeavors to defeat the Doctor."
HOMEPAGE="https://github.com/EXL/NXEngine/"
COPYRIGHT="2017 Retroguru"
LICENSE="GNU GPL v3"
REVISION="1"
SOURCE_URI="https://github.com/EXL/NXEngine/archive/v$portVersion-Rev4.tar.gz"
CHECKSUM_SHA256="d467c112e81d4c56337ebf6968bd8bd781bce9140f674e72009a5274d2c15784"
SOURCE_DIR="NXEngine-$portVersion-Rev4"
SOURCE_URI_2="http://www.cavestory.org/downloads/LIN64-NXEngine-$portVersion-Rev-4.tar.gz"
CHECKSUM_SHA256_2="ddc1f69349bd4239adc6485e0377b503425a7960bbd6696c1b30ea6ed11e1851"
SOURCE_DIR_2="NXEngine"
PATCHES="nxengine-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86 x86_64"
PROVIDES="
nxengine = $portVersion
app:nxengine = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libsdl$secondaryArchSuffix
lib:libSDL_mixer$secondaryArchSuffix
lib:libSDL_ttf$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= r1~alpha4_pm_hrev51410-1
devel:libfreetype$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libSDL_mixer$secondaryArchSuffix
devel:libSDL_ttf$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:qmake >= 5
"
BUILD()
{
mkdir -p build_haiku && cd build_haiku
qmake ..
make $jobArgs
}
INSTALL()
{
cd build_haiku
mkdir -p $appsDir/NXEngine
cp NXEngine $appsDir/NXEngine
cp -r $sourceDir2/* $appsDir/NXEngine
rm -rf $appsDir/NXEngine/nx
addAppDeskbarSymlink $appsDir/NXEngine/NXEngine
}

View File

@@ -0,0 +1,94 @@
SUMMARY="An open-source rewrite engine of the Cave Story"
DESCRIPTION="The platform-adventure game focuses on an amnesiac protagonist \
who awakens in a cave. Through his explorations, he discovers a plot by the \
Doctor, a megalomaniac who intends to force the inhabitants of the cave to \
fight for him in his bid to conquer the world. The protagonist is thrust \
into the position of savior as he endeavors to defeat the Doctor."
HOMEPAGE="http://exlmoto.ru/nxengine/"
COPYRIGHT="2010-2016 Caitlin (rogueeve) Shaw"
LICENSE="GNU GPL v3"
REVISION="1"
srcGitRev="61642da9fec041fc0791dbb51e423f3e2e117423"
portVersionSub="`echo $portVersion | cut -c 1-7`"
SOURCE_URI="https://github.com/EXL/NXEngine/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="e23aa51472e9c9b1d31ac75203bec1b7ddc23430cc63e89b23d0e07b50171004"
SOURCE_DIR="NXEngine-$srcGitRev"
SOURCE_URI_2="http://www.cavestory.org/downloads/LIN64-NXEngine-$portVersionSub-Rev-4.tar.gz"
CHECKSUM_SHA256_2="ddc1f69349bd4239adc6485e0377b503425a7960bbd6696c1b30ea6ed11e1851"
SOURCE_DIR_2="NXEngine"
SOURCE_URI_3="http://www.cavestory.org/downloads/LIN64-NXEngine-RUS-$portVersionSub-Rev-4.tar.gz"
CHECKSUM_SHA256_3="f43b87a69ce93d99c2261b2a7f637fcbc25a8f3b677e178d76659be5e1ccb556"
SOURCE_DIR_3="NXEngine-RUS"
ADDITIONAL_FILES="
nxengine.rdef.in
NXEngine.sh
"
ARCHITECTURES="!x86_gcc2 x86_64 ?x86"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
nxengine$secondaryArchSuffix = $portVersion
app:nxengine$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libfreetype$secondaryArchSuffix
lib:libsdl$secondaryArchSuffix
lib:libSDL_ttf$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel >= r1~alpha4_pm_hrev51410-1
devel:libfreetype$secondaryArchSuffix
devel:libsdl$secondaryArchSuffix
devel:libSDL_ttf$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
BUILD()
{
mkdir -p build/
make -f Makefile.haiku clean && rm -f nx
make $jobArgs -f Makefile.haiku
cp nx build/nx
make -f Makefile.haiku clean && rm -f nx
make $jobArgs DEFINES="-D_L10N_CP1251" -f Makefile.haiku
cp nx build/nx-rus
}
INSTALL()
{
cd build/
mkdir -p $appsDir/NXEngine/{ENG,RUS}
local APP_SIGNATURE="application/x-vnd.nxengine"
local MAJOR="`echo "$portVersion" | cut -d. -f1`"
local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
local MINOR="`echo "$portVersion" | cut -d. -f4 | cut -c 1-1`"
local LONG_INFO="$SUMMARY"
sed \
-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
-e "s|@MAJOR@|$MAJOR|" \
-e "s|@MIDDLE@|$MIDDLE|" \
-e "s|@MINOR@|$MINOR|" \
-e "s|@LONG_INFO@|$LONG_INFO|" \
$portDir/additional-files/nxengine.rdef.in > $sourceDir/build/nxengine.rdef
cp $portDir/additional-files/NXEngine.sh $appsDir/NXEngine/NXEngine
chmod +x $appsDir/NXEngine/NXEngine
settype -t application/x-vnd.Be-elfexecutable $appsDir/NXEngine/NXEngine
rc nxengine.rdef
resattr -o $appsDir/NXEngine/NXEngine nxengine.rsrc
cp -r $sourceDir2/* $appsDir/NXEngine/ENG
cp -r $sourceDir3/* $appsDir/NXEngine/RUS
rm -rf $appsDir/NXEngine/{ENG,RUS}/nx
rm -rf $appsDir/NXEngine/{ENG,RUS}/settings.dat
cp nx $appsDir/NXEngine/ENG/
cp nx-rus $appsDir/NXEngine/RUS/
addAppDeskbarSymlink $appsDir/NXEngine/NXEngine
}

View File

@@ -1,68 +0,0 @@
From 82fd9718e1b3faf8f1d018b5c584c016efc36ff5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 16 Sep 2017 10:09:57 +0200
Subject: Haiku patches
diff --git a/NXEngine.pro b/NXEngine.pro
index 23e23e4..54069c4 100644
--- a/NXEngine.pro
+++ b/NXEngine.pro
@@ -55,6 +55,8 @@ win32-g++ | linux-g++ | linux-g++-64 {
}
} linux-arm-gnueabi-g++ {
DEFINES += _320X240 _MOTOMAGX _SDL_MIXER
+} haiku {
+ DEFINES += _BSD_SOURCE
}
# Debug
@@ -93,6 +95,8 @@ win32-g++: {
} linux-arm-gnueabi-g++: {
INCLUDEPATH += /opt/toolchains/motomagx/arm-eabi2/include
INCLUDEPATH += /opt/toolchains/motomagx/arm-eabi2/include/SDL
+} haiku {
+ INCLUDEPATH += $$system(finddir B_SYSTEM_HEADERS_DIRECTORY)/SDL
}
# Librares
@@ -105,6 +109,8 @@ win32-g++ {
LIBS += -lSDLmain -lSDL -lSDL_ttf -lSDL_mixer
} linux-arm-gnueabi-g++ {
LIBS += $$system(sdl-config --libs) -lSDL_mixer -lSDL_ttf -lstdc++ -lm -lfreetype
+} haiku {
+ LIBS += $$system(sdl-config --libs) -lSDL_mixer -lSDL_ttf -lfreetype
}
# Win32 Icon
diff --git a/main.cpp b/main.cpp
index 026cbac..e76f0d0 100644
--- a/main.cpp
+++ b/main.cpp
@@ -5,6 +5,10 @@
#include <SDL/SDL_mixer.h>
#endif
+#ifdef __HAIKU__
+#include <libgen.h>
+#endif
+
#include <stdarg.h>
#include <unistd.h>
#include "graphics/safemode.h"
@@ -27,6 +31,12 @@ int flipacceltime = 0;
int main(int argc, char *argv[])
{
+
+#ifdef __HAIKU__
+ // To make it able to start from Tracker
+ chdir(dirname(argv[0]));
+#endif
+
bool inhibit_loadfade = false;
bool error = false;
bool freshstart;
--
2.14.1