Add Protrekkr.

More fun with music!
This commit is contained in:
Adrien Destugues
2014-03-04 22:49:47 +01:00
parent b85bf977d2
commit ec9690746d
2 changed files with 871 additions and 0 deletions

View File

@@ -0,0 +1,815 @@
From 4662e2c5030efdf290f6320eaf077abc820eb51e Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 4 Mar 2014 21:49:16 +0100
Subject: Import initial patch.
diff --git a/makefile.haiku b/makefile.haiku
new file mode 100644
index 0000000..efbfd22
--- /dev/null
+++ b/makefile.haiku
@@ -0,0 +1,199 @@
+CXX = g++-x86
+
+LIBS = src/extralibs/tinyxml/tinyxml.o \
+ src/extralibs/tinyxml/tinyxmlparser.o \
+ src/extralibs/tinyxml/tinystr.o \
+ src/extralibs/tinyxml/tinyxmlerror.o \
+ -lSDL -lsdldraw -lz -lstdc++ -lsupc++ -lgame
+
+FLAGS = -O2 -fno-strict-aliasing -ffast-math -fno-rtti -fno-exceptions -I/usr/local/include -L/usr/local/lib -Lsrc/extralibs/sdl_draw -Lsrc/extralibs/zlib-1.2.3 -fpermissive \
+ -D __GCC__ -D __NO_MIDI__ -D __MOT_SWAP__
+
+EXEOBJS = ptk.o \
+ editor_303.o editor_pattern.o editor_sequencer.o editor_track.o editor_track_fx.o \
+ patterns_blocks.o editor_synth.o editor_sample.o editor_fx_setup.o editor_setup.o \
+ editor_diskio.o editor_reverb.o editor_instrument.o editor_midi.o \
+ samples_pack.o files_list.o files.o mods.o patterns.o reverbs.o midi_cfg.o \
+ bits.o pack.o tinypack.o words.o wputils.o \
+ config.o 303s.o synths.o insts.o ptps.o \
+ midi.o midi_dispatch.o \
+ timer.o main.o \
+ misc_draw.o draw_primitives.o requesters.o xml.o gadgets.o \
+ samples_ops.o aiff.o riff.o \
+ spline.o tb_303.o wavpack.o samples_unpack.o replay.o synth.o endianness.o \
+ sounddriver_haiku.o
+
+all: protrekkr
+
+clean: RemObj
+
+RemObj:
+ -rm -f $(EXEOBJS)
+
+protrekkr: $(EXEOBJS)
+ (cd src/extralibs/sdl_draw; make -f makefile.haiku)
+ (cd src/extralibs/tinyxml; make)
+ (cd src/extralibs/zlib-1.2.3; make)
+ $(CXX) -o ./release/distrib/ptk_haiku -L./ $(FLAGS) $(EXEOBJS) $(LIBS)
+ strip -s -x ./release/distrib/ptk_haiku
+ chmod +x ./release/distrib/ptk_haiku
+# -rm -f $(EXEOBJS)
+
+ptk.o: src/ptk.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_303.o: src/editors/editor_303.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_pattern.o: src/editors/editor_pattern.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_sequencer.o: src/editors/editor_sequencer.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_track.o: src/editors/editor_track.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_track_fx.o: src/editors/editor_track_fx.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+patterns_blocks.o: src/editors/patterns_blocks.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_synth.o: src/editors/editor_synth.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_sample.o: src/editors/editor_sample.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_fx_setup.o: src/editors/editor_fx_setup.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_setup.o: src/editors/editor_setup.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_diskio.o: src/editors/editor_diskio.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_reverb.o: src/editors/editor_reverb.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_instrument.o: src/editors/editor_instrument.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+editor_midi.o: src/editors/editor_midi.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+samples_pack.o: src/samples/samples_pack.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+files_list.o: src/files/files_list.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+files.o: src/files/files.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+mods.o: src/files/mods.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+patterns.o: src/files/patterns.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+reverbs.o: src/files/reverbs.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+midi_cfg.o: src/files/midi_cfg.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+config.o: src/files/config.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+303s.o: src/files/303s.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+synths.o: src/files/synths.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+insts.o: src/files/insts.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+ptps.o: src/files/ptps.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+midi.o: src/midi/midi.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+RtMidi.o: src/midi/RtMidi.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+midi_dispatch.o: src/midi/midi_dispatch.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+timer.o: src/support/timer.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+main.o: src/support/main.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+misc_draw.o: src/ui/misc_draw.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+draw_primitives.o: src/ui/draw_primitives.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+requesters.o: src/ui/requesters.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+xml.o: src/ui/xml.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+gadgets.o: src/ui/gadgets.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+samples_ops.o: src/samples/samples_ops.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+aiff.o: src/samples/aiff/aiff.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+riff.o: src/samples/wav/riff.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+spline.o: release/distrib/replay/lib/spline.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+tb_303.o: release/distrib/replay/lib/tb_303.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+wavpack.o: release/distrib/replay/lib/wavpack.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+samples_unpack.o: release/distrib/replay/lib/samples_unpack.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+replay.o: release/distrib/replay/lib/replay.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+synth.o: release/distrib/replay/lib/synth.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+endianness.o: release/distrib/replay/lib/endianness.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+sounddriver_haiku.o: release/distrib/replay/lib/sounddriver/sounddriver_haiku.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+bits.o: src/samples/wavpack/bits.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+pack.o: src/samples/wavpack/pack.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+words.o: src/samples/wavpack/words.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+wputils.o: src/samples/wavpack/wputils.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
+
+tinypack.o: src/samples/wavpack/tinypack.cpp
+ $(CXX) -c -o $(@) $(FLAGS) $<
diff --git a/release/distrib/replay/lib/include/replay.h b/release/distrib/replay/lib/include/replay.h
index 1945eab..51778e4 100644
--- a/release/distrib/replay/lib/include/replay.h
+++ b/release/distrib/replay/lib/include/replay.h
@@ -49,6 +49,8 @@
#include "../sounddriver/include/sounddriver_aos4.h"
#elif defined(__PSP__)
#include "../sounddriver/include/sounddriver_psp.h"
+#elif defined(__HAIKU__)
+#include "../sounddriver/include/sounddriver_haiku.h"
#else
#error "Can't work without any sound driver !"
#endif
diff --git a/release/distrib/replay/lib/replay.cpp b/release/distrib/replay/lib/replay.cpp
index ea2ee35..f720cd1 100644
--- a/release/distrib/replay/lib/replay.cpp
+++ b/release/distrib/replay/lib/replay.cpp
@@ -43,6 +43,10 @@
#define int32 int32_t
#endif
+#if defined(__HAIKU__)
+#include <SupportDefs.h>
+#endif
+
#if !defined(__STAND_ALONE__)
#include "../../../../src/midi/include/midi.h"
#include "../../../../src/include/variables.h"
diff --git a/release/distrib/replay/lib/sounddriver/include/sounddriver_haiku.h b/release/distrib/replay/lib/sounddriver/include/sounddriver_haiku.h
new file mode 100644
index 0000000..294c6f8
--- /dev/null
+++ b/release/distrib/replay/lib/sounddriver/include/sounddriver_haiku.h
@@ -0,0 +1,84 @@
+// ------------------------------------------------------
+// Protrekkr
+// Based on Juan Antonio Arguelles Rius's NoiseTrekker.
+//
+// Copyright (C) 2008-2010 Franck Charlet.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL FRANCK CHARLET OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+// ------------------------------------------------------
+
+#ifndef _SOUNDDRIVER_LINUX_H_
+#define _SOUNDDRIVER_LINUX_H_
+
+// ------------------------------------------------------
+// Includes
+#include <stdio.h>
+#include <stdlib.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <sys/ioctl.h>
+#include <pthread.h>
+#include <float.h>
+#include <memory.h>
+#include <math.h>
+
+#define STDCALL
+
+#define TRUE 1
+#define FALSE 0
+
+// ------------------------------------------------------
+// Constants
+#define AUDIO_PCM_FREQ 44100
+
+#define AUDIO_DBUF_CHANNELS 2
+#define AUDIO_DBUF_RESOLUTION 16
+
+// ------------------------------------------------------
+// Types
+typedef unsigned int Uint32;
+typedef unsigned char Uint8;
+
+// ------------------------------------------------------
+// Functions
+extern int AUDIO_Latency;
+extern int AUDIO_Milliseconds;
+
+#if !defined(__STAND_ALONE__) && !defined(__WINAMP__)
+void Message_Error(char *Message);
+#endif
+
+int AUDIO_Init_Driver(void (STDCALL *Mixer)(Uint8 *, Uint32));
+int AUDIO_Create_Sound_Buffer(int milliseconds);
+void AUDIO_Stop_Sound_Buffer(void);
+void AUDIO_Stop_Driver(void);
+void AUDIO_Play(void);
+void AUDIO_Stop(void);
+int AUDIO_IsPlaying(void);
+float AUDIO_GetTime(void);
+int AUDIO_GetSamples(void);
+void AUDIO_ResetTimer(void);
+
+#endif
diff --git a/release/distrib/replay/lib/sounddriver/sounddriver_haiku.cpp b/release/distrib/replay/lib/sounddriver/sounddriver_haiku.cpp
new file mode 100644
index 0000000..7791631
--- /dev/null
+++ b/release/distrib/replay/lib/sounddriver/sounddriver_haiku.cpp
@@ -0,0 +1,213 @@
+// ------------------------------------------------------
+// Protrekkr
+// Based on Juan Antonio Arguelles Rius's NoiseTrekker.
+//
+// Copyright (C) 2008-2010 Franck Charlet.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// 1. Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+//
+// 2. Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+//
+// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
+// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+// ARE DISCLAIMED. IN NO EVENT SHALL FRANCK CHARLET OR CONTRIBUTORS BE LIABLE
+// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+// SUCH DAMAGE.
+// ------------------------------------------------------
+
+// ------------------------------------------------------
+// Includes
+#include "include/sounddriver_haiku.h"
+#include <game/StreamingGameSound.h>
+#include <media/MediaDefs.h>
+
+#include <assert.h>
+
+// ------------------------------------------------------
+// Variables
+unsigned int AUDIO_To_Fill;
+int AUDIO_Samples;
+int AUDIO_Play_Flag;
+float AUDIO_Timer;
+
+int volatile AUDIO_Acknowledge;
+BStreamingGameSound* AUDIO_Device;
+Uint32 Amount;
+
+int AUDIO_SoundBuffer_Size;
+int AUDIO_Latency;
+int AUDIO_Milliseconds = 20;
+int AUDIO_16Bits;
+
+// ------------------------------------------------------
+// Functions
+int AUDIO_Create_Sound_Buffer(int milliseconds);
+void AUDIO_Stop_Sound_Buffer(void);
+void (STDCALL *AUDIO_Mixer)(Uint8 *, Uint32);
+void AUDIO_Mixer_Fill_Buffer(void *, Uint32);
+void AUDIO_Synth_Play(void);
+
+// ------------------------------------------------------
+// Name: AUDIO_Thread()
+// Desc: Audio rendering
+static void AUDIO_Callback(void* cookie, void* inBuffer, size_t byteCount, BStreamingGameSound* device)
+{
+ assert(byteCount != 0);
+ if(AUDIO_Play_Flag)
+ {
+ AUDIO_Mixer((Uint8 *) inBuffer, byteCount);
+ }
+ else
+ {
+ unsigned int i;
+ char *pSamples = (char *) inBuffer;
+ for(i = 0; i < byteCount; i++)
+ {
+ pSamples[i] = 0;
+ }
+ }
+ AUDIO_Samples += byteCount;
+ AUDIO_Timer = ((((float) AUDIO_Samples) * (1.0f / (float) AUDIO_Latency)) * 1000.0f);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Init_Driver()
+// Desc: Init the audio driver
+int AUDIO_Init_Driver(void (*Mixer)(Uint8 *, Uint32))
+{
+ AUDIO_Mixer = Mixer;
+
+ AUDIO_Device = 0;
+ return(AUDIO_Create_Sound_Buffer(AUDIO_Milliseconds));
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Create_Sound_Buffer()
+// Desc: Create an audio buffer of given milliseconds
+int AUDIO_Create_Sound_Buffer(int milliseconds)
+{
+ int num_fragments;
+ int frag_size;
+ int found_pcmformat = TRUE;
+
+ if(milliseconds < 10) milliseconds = 10;
+ if(milliseconds > 250) milliseconds = 250;
+
+ num_fragments = 6;
+ frag_size = (int) (AUDIO_PCM_FREQ * (milliseconds / 1000.0f));
+
+ AUDIO_16Bits = TRUE;
+
+ struct gs_audio_format format;
+ format.frame_rate = AUDIO_PCM_FREQ;
+ format.channel_count = AUDIO_DBUF_CHANNELS;
+ format.format = gs_audio_format::B_GS_S16;
+ format.byte_order = B_MEDIA_LITTLE_ENDIAN;
+ format.buffer_size = 4096 * num_fragments;
+
+ AUDIO_Device = new BStreamingGameSound(4096, &format);
+ assert(AUDIO_Device->InitCheck() == B_OK);
+
+ AUDIO_SoundBuffer_Size = format.buffer_size;
+
+ AUDIO_Latency = AUDIO_SoundBuffer_Size;
+ assert(AUDIO_Latency != 0);
+
+ AUDIO_Device->SetStreamHook(&AUDIO_Callback, NULL);
+ AUDIO_Device->StartPlaying();
+ return(TRUE);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Wait_For_Thread()
+// Desc: Wait for a command acknowledgment from the thread
+void AUDIO_Wait_For_Thread(void)
+{
+ usleep(10);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Play()
+// Desc: Play the sound buffer endlessly
+void AUDIO_Play(void)
+{
+ AUDIO_ResetTimer();
+ AUDIO_Play_Flag = TRUE;
+ AUDIO_Wait_For_Thread();
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_IsPlaying()
+// Desc: Return the playing state of the sound buffer
+int AUDIO_IsPlaying(void)
+{
+ return(AUDIO_Play_Flag);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_ResetTimer()
+// Desc: Reset the samples counter
+void AUDIO_ResetTimer(void)
+{
+ AUDIO_Samples = 0;
+ AUDIO_Timer = 0.0f;
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_GetTime()
+// Desc: Return the played time in milliseconds
+float AUDIO_GetTime(void)
+{
+ return(AUDIO_Timer);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_GetSamples()
+// Desc: Return the played time in milliseconds
+int AUDIO_GetSamples(void)
+{
+ return(AUDIO_Samples);
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Stop()
+// Desc: Stop the sound buffer
+void AUDIO_Stop(void)
+{
+ AUDIO_Play_Flag = FALSE;
+ AUDIO_Wait_For_Thread();
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Stop_Sound_Buffer()
+// Desc: Release the audio buffer
+void AUDIO_Stop_Sound_Buffer(void)
+{
+ AUDIO_Stop();
+ AUDIO_Device->StopPlaying();
+}
+
+// ------------------------------------------------------
+// Name: AUDIO_Stop_Driver()
+// Desc: Stop everything
+void AUDIO_Stop_Driver(void)
+{
+ AUDIO_Stop_Sound_Buffer();
+ delete AUDIO_Device;
+ AUDIO_Device = 0;
+}
+
diff --git a/release/distrib/replay/lib/wavpack.cpp b/release/distrib/replay/lib/wavpack.cpp
index 4ced7c6..942d30d 100644
--- a/release/distrib/replay/lib/wavpack.cpp
+++ b/release/distrib/replay/lib/wavpack.cpp
@@ -33,6 +33,8 @@
// SUCH DAMAGE.
// ------------------------------------------------------
+#include <stdint.h>
+
#include "include/samples_unpack.h"
#include "include/wavpack.h"
diff --git a/src/editors/editor_instrument.cpp b/src/editors/editor_instrument.cpp
index 83312cf..0cb4db7 100644
--- a/src/editors/editor_instrument.cpp
+++ b/src/editors/editor_instrument.cpp
@@ -44,6 +44,10 @@
#include "../files/include/files.h"
#include "../ui/include/requesters.h"
+#if defined(__HAIKU__)
+#include <SupportDefs.h>
+#endif
+
// ------------------------------------------------------
// Variables
extern REQUESTER Overwrite_Requester;
diff --git a/src/editors/editor_pattern.cpp b/src/editors/editor_pattern.cpp
index e4674ac..29d4dec 100644
--- a/src/editors/editor_pattern.cpp
+++ b/src/editors/editor_pattern.cpp
@@ -38,6 +38,10 @@
#include "include/editor_instrument.h"
#include "include/editor_sequencer.h"
+#if defined(__HAIKU__)
+#include <SupportDefs.h>
+#endif
+
// ------------------------------------------------------
// Constants
#define POS_HORIZ_SLIDER 716
diff --git a/src/extralibs/sdl_draw/makefile.haiku b/src/extralibs/sdl_draw/makefile.haiku
new file mode 100644
index 0000000..e321d5d
--- /dev/null
+++ b/src/extralibs/sdl_draw/makefile.haiku
@@ -0,0 +1,26 @@
+LIBFLAGS = -c
+FLAGS = -O2 -D G_OS_WIN32 -D __LINUX__ -D __GCC__
+LIBOBJS = draw_hline.o draw_line.o draw_pixel.o draw_vline.o
+
+all: sdldraw
+clean: RemLibObj
+
+RemLibObj:
+ -rm -f $(LIBOBJS)
+
+sdldraw: $(LIBOBJS)
+ ar -d libsdldraw.a
+ ar -r libsdldraw.a $(LIBOBJS)
+ -rm -f $(LIBOBJS)
+
+draw_hline.o: src/draw_hline.cpp
+ g++-x86 -o $(@) $(LIBFLAGS) $(FLAGS) src/draw_hline.cpp
+
+draw_line.o: src/draw_line.cpp
+ g++-x86 -o $(@) $(LIBFLAGS) $(FLAGS) src/draw_line.cpp
+
+draw_pixel.o: src/draw_pixel.cpp
+ g++-x86 -o $(@) $(LIBFLAGS) $(FLAGS) src/draw_pixel.cpp
+
+draw_vline.o: src/draw_vline.cpp
+ g++-x86 -o $(@) $(LIBFLAGS) $(FLAGS) src/draw_vline.cpp
diff --git a/src/extralibs/tinyxml/makefile.haiku b/src/extralibs/tinyxml/makefile.haiku
new file mode 100644
index 0000000..5ffb952
--- /dev/null
+++ b/src/extralibs/tinyxml/makefile.haiku
@@ -0,0 +1,130 @@
+#****************************************************************************
+#
+# Makefile for TinyXml test.
+# Lee Thomason
+# www.grinninglizard.com
+#
+# This is a GNU make (gmake) makefile
+#****************************************************************************
+
+# DEBUG can be set to YES to include debugging info, or NO otherwise
+DEBUG := NO
+
+# PROFILE can be set to YES to include profiling info, or NO otherwise
+PROFILE := NO
+
+# TINYXML_USE_STL can be used to turn on STL support. NO, then STL
+# will not be used. YES will include the STL files.
+TINYXML_USE_STL := NO
+
+#****************************************************************************
+
+CC := gcc
+CXX := g++
+LD := g++
+AR := ar rc
+RANLIB := ranlib
+
+DEBUG_CFLAGS := -Wall -Wno-format -g -DDEBUG
+RELEASE_CFLAGS := -Wall -Wno-unknown-pragmas -Wno-format -O3
+
+LIBS :=
+
+DEBUG_CXXFLAGS := ${DEBUG_CFLAGS}
+RELEASE_CXXFLAGS := ${RELEASE_CFLAGS}
+
+DEBUG_LDFLAGS := -g
+RELEASE_LDFLAGS :=
+
+ifeq (YES, ${DEBUG})
+ CFLAGS := ${DEBUG_CFLAGS}
+ CXXFLAGS := ${DEBUG_CXXFLAGS}
+ LDFLAGS := ${DEBUG_LDFLAGS}
+else
+ CFLAGS := ${RELEASE_CFLAGS}
+ CXXFLAGS := ${RELEASE_CXXFLAGS}
+ LDFLAGS := ${RELEASE_LDFLAGS}
+endif
+
+ifeq (YES, ${PROFILE})
+ CFLAGS := ${CFLAGS} -pg -O3
+ CXXFLAGS := ${CXXFLAGS} -pg -O3
+ LDFLAGS := ${LDFLAGS} -pg
+endif
+
+#****************************************************************************
+# Preprocessor directives
+#****************************************************************************
+
+ifeq (YES, ${TINYXML_USE_STL})
+ DEFS := -DTIXML_USE_STL
+else
+ DEFS :=
+endif
+
+#****************************************************************************
+# Include paths
+#****************************************************************************
+
+#INCS := -I/usr/include/g++-2 -I/usr/local/include
+INCS :=
+
+
+#****************************************************************************
+# Makefile code common to all platforms
+#****************************************************************************
+
+CFLAGS := ${CFLAGS} ${DEFS}
+CXXFLAGS := ${CXXFLAGS} ${DEFS}
+
+#****************************************************************************
+# Targets of the build
+#****************************************************************************
+
+OUTPUT := xmltest
+
+all: ${OUTPUT}
+
+
+#****************************************************************************
+# Source files
+#****************************************************************************
+
+SRCS := tinyxml.cpp tinyxmlparser.cpp xmltest.cpp tinyxmlerror.cpp tinystr.cpp
+
+# Add on the sources for libraries
+SRCS := ${SRCS}
+
+OBJS := $(addsuffix .o,$(basename ${SRCS}))
+
+#****************************************************************************
+# Output
+#****************************************************************************
+
+${OUTPUT}: ${OBJS}
+ ${LD} -o $@ ${LDFLAGS} ${OBJS} ${LIBS} ${EXTRA_LIBS}
+
+#****************************************************************************
+# common rules
+#****************************************************************************
+
+# Rules for compiling source files to object files
+%.o : %.cpp
+ ${CXX} -c ${CXXFLAGS} ${INCS} $< -o $@
+
+%.o : %.c
+ ${CC} -c ${CFLAGS} ${INCS} $< -o $@
+
+dist:
+ bash makedistlinux
+
+clean:
+ -rm -f core ${OBJS} ${OUTPUT}
+
+depend:
+ #makedepend ${INCS} ${SRCS}
+
+tinyxml.o: tinyxml.h tinystr.h
+tinyxmlparser.o: tinyxml.h tinystr.h
+xmltest.o: tinyxml.h tinystr.h
+tinyxmlerror.o: tinyxml.h tinystr.h
diff --git a/src/files/files_list.cpp b/src/files/files_list.cpp
index 6cd2848..fed9828 100644
--- a/src/files/files_list.cpp
+++ b/src/files/files_list.cpp
@@ -286,7 +286,7 @@ void Set_Current_Dir(void)
}
}
-#if defined(__LINUX__) || defined(__MACOSX__)
+#if defined(__LINUX__) || defined(__MACOSX__) || defined(__HAIKU__)
int list_file(const char *fpath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
{
int i;
diff --git a/src/samples/include/samples_ops.h b/src/samples/include/samples_ops.h
index 3b0a640..752427b 100644
--- a/src/samples/include/samples_ops.h
+++ b/src/samples/include/samples_ops.h
@@ -37,6 +37,10 @@
#include "../../include/variables.h"
#include "../../ui/include/misc_draw.h"
+#if defined(__HAIKU__)
+#include <SupportDefs.h>
+#endif
+
// ------------------------------------------------------
// Variables
extern int cur_sample_buffer;
diff --git a/src/support/main.cpp b/src/support/main.cpp
index c08685a..bd4c97b 100644
--- a/src/support/main.cpp
+++ b/src/support/main.cpp
@@ -59,6 +59,10 @@
#include <mach-o/dyld.h>
#endif
+#if defined(__HAIKU__)
+#include <libgen.h>
+#endif
+
#if defined(__AMIGAOS4__) || defined(__AROS__)
const char *AMIGA_VERSION = "\0$VER: " TITLE " " VER_VER "." VER_REV "." VER_REVSMALL "\0";
#endif
@@ -444,6 +448,9 @@ extern SDL_NEED int SDL_main(int argc, char *argv[])
}
CHDIR(ExePath);
+#elif defined(__HAIKU__)
+ chdir(dirname(argv[0]));
+ GETCWD(ExePath, MAX_PATH);
#elif defined(__AMIGAOS4__) || defined(__AROS__)
CHDIR("/PROGDIR/");
GETCWD(ExePath, MAX_PATH);
--
1.8.3.4

View File

@@ -0,0 +1,56 @@
SUMMARY="Tracker program to create small sized electronic music"
DESCRIPTION="
ProTrekkr (formerly known as NoiseTrekker by Juan Antonio Arguelles Rius aka \
Arguru) is a tracker program combining a software synthesizer together with a \
traditional samples tracker which can be used to create electronic music (like \
psytrance, trance goa, hard acid, IDM, chip, techno, etc.) for small sized \
intros, demos or games.
"
HOMEPAGE="http://code.google.com/p/protrekkr/"
COPYRIGHT="2008-2010 Franck Charlet.
Based on Juan Antonio Arguelles Rius's NoiseTrekker.
"
LICENSE="BSD (3-clause)"
SRC_URI="svn+http://protrekkr.googlecode.com/svn/trunk/#670"
REVISION="1"
ARCHITECTURES="x86"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
# x86_gcc2 is fine as primary target architecture as long as we're building
# for a different secondary architecture.
ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
protrekkr = $portVersion
app:Protrekkr = $portVersion
"
REQUIRES="
haiku${secondaryArchSuffix} >= $haikuVersion
lib:libSDL$secondaryArchSuffix
"
BUILD_REQUIRES="
devel:libSDL$secondaryArchSuffix
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel >= $haikuVersion
cmd:gcc${secondaryArchSuffix}
cmd:ld${secondaryArchSuffix}
cmd:make
"
PATCHES="protrekkr-2.5.4.patchset"
BUILD()
{
make -f makefile.haiku
}
INSTALL()
{
TARGET_DIR=$appsDir/Protrekkr
mkdir -p $TARGET_DIR
cd release/distrib
cp -r history.txt instruments license.txt modules presets ptk_haiku replay reverbs skins $TARGET_DIR
addAppDeskbarSymlink $TARGET_DIR/ptk_haiku Protrekkr
}