diff --git a/.gitignore b/.gitignore index b5814cd2..50891b83 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ bin/** build/** projects/buildPSP/** -tracks/** \ No newline at end of file +tracks/** diff --git a/projects/BUILD_HOW_TO.txt b/projects/BUILD_HOW_TO.txt index 13198a76..606b6b67 100644 --- a/projects/BUILD_HOW_TO.txt +++ b/projects/BUILD_HOW_TO.txt @@ -9,3 +9,7 @@ GP2X: Compile under minsys PSP: Compile under minsys DINGOO: Compile under Linux + +RS97: Compile under Linux and type make PLATFORM=RS97 + +Bittboy: Compile under Linux and type make PLATFORM=BITTBOY diff --git a/projects/Makefile b/projects/Makefile index 59768b2b..a28adc0b 100644 --- a/projects/Makefile +++ b/projects/Makefile @@ -115,6 +115,32 @@ DINGOODIRS := . \ ../sources/Adapters/SDL/GUI \ ../sources/Adapters/SDL/Timer +RS97DIRS := . \ + ../sources/Adapters/DINGOO/Main \ + ../sources/Adapters/Unix/FileSystem \ + ../sources/System/Process \ + ../sources/Adapters/Unix/Process \ + ../sources/Adapters/DINGOO/System \ + ../sources/Adapters/DINGOO/Midi \ + ../sources/Adapters/DINGOO/Audio \ + ../sources/Adapters/SDL/Audio \ + ../sources/Adapters/SDL/Process \ + ../sources/Adapters/SDL/GUI \ + ../sources/Adapters/SDL/Timer + +BITTBOYDIRS := . \ + ../sources/Adapters/DINGOO/Main \ + ../sources/Adapters/Unix/FileSystem \ + ../sources/System/Process \ + ../sources/Adapters/Unix/Process \ + ../sources/Adapters/DINGOO/System \ + ../sources/Adapters/DINGOO/Midi \ + ../sources/Adapters/DINGOO/Audio \ + ../sources/Adapters/SDL/Audio \ + ../sources/Adapters/SDL/Process \ + ../sources/Adapters/SDL/GUI \ + ../sources/Adapters/SDL/Timer + PSPDIRS := . \ ../sources/Adapters/PSP/Main \ ../sources/Adapters/PSP/FileSystem \ @@ -199,6 +225,40 @@ DINGOOFILES := GPSDLMain.o \ SDLEventManager.o \ SDLGUIWindowImp.o +RS97FILES := GPSDLMain.o \ + UnixFileSystem.o \ + DINGOOAudio.o \ + Process.o \ + UnixProcess.o \ + SDLAudioDriver.o \ + DINGOOAudioDriver.o \ + DINGOOSystem.o \ + DINGOOEventQueue.o \ + SDLProcess.o \ + SDLTimer.o \ + GUIFactory.o \ + SDLEventManager.o \ + DINGOOSerialMidiDevice.o \ + DINGOOMidiService.o \ + SDLGUIWindowImp.o + +BITTBOYFILES := GPSDLMain.o \ + UnixFileSystem.o \ + DINGOOAudio.o \ + Process.o \ + UnixProcess.o \ + SDLAudioDriver.o \ + DINGOOAudioDriver.o \ + DINGOOSystem.o \ + DINGOOEventQueue.o \ + SDLProcess.o \ + SDLTimer.o \ + GUIFactory.o \ + SDLEventManager.o \ + DINGOOSerialMidiDevice.o \ + DINGOOMidiService.o \ + SDLGUIWindowImp.o + PSPFILES := PSPmain.o \ PSPFileSystem.o \ Process.o \ diff --git a/projects/Makefile.BITTBOY b/projects/Makefile.BITTBOY new file mode 100644 index 00000000..ab201985 --- /dev/null +++ b/projects/Makefile.BITTBOY @@ -0,0 +1,19 @@ + +DEVKIT=/opt/bittboy-toolchain + +TARGET = lgpt.elf + +TOOLPATH=$(DEVKIT)/usr/bin +PREFIX := arm-linux- +SDL_BASE = /opt/bittboy-toolchain/usr/arm-miyoo-linux-musleabi/sysroot/usr/bin/ + +include $(PWD)/bittboy_rules + +CFLAGS := `$(SDL_BASE)sdl-config --cflags` -O3 -D_NDEBUG -D_NO_JACK_ -Wall -DPLATFORM_DINGOO -I$(PWD)/../sources -D__LINUX_ALSA__ -DCPP_MEMORY -DRS97 + +CXXFLAGS:= $(CFLAGS) -fpermissive -std=gnu++03 + +EXTENSION:= elf + +LIBS := -lSDL -lasound -lpthread +LIBDIRS := $(DEKVIT)/usr/lib diff --git a/projects/Makefile.RS97 b/projects/Makefile.RS97 new file mode 100644 index 00000000..1aa525f2 --- /dev/null +++ b/projects/Makefile.RS97 @@ -0,0 +1,19 @@ + +DEVKIT=/opt/rs97-toolchain + +TARGET = lgpt.dge + +TOOLPATH=$(DEVKIT)/usr/bin +PREFIX := mipsel-linux- +SDL_BASE = /opt/rs97-toolchain/usr/mipsel-buildroot-linux-musl/sysroot/usr/bin/ + +include $(PWD)/rs97_rules + +CFLAGS := `$(SDL_BASE)sdl-config --cflags` -O3 -D_NDEBUG -D_NO_JACK_ -Wall -DPLATFORM_DINGOO -I$(PWD)/../sources -D__LINUX_OSS__ -DCPP_MEMORY -DRS97 -DUSB_TTY + +CXXFLAGS:= $(CFLAGS) -fpermissive -std=gnu++03 + +EXTENSION:= dge + +LIBS := -lSDL -lpthread +LIBDIRS := $(DEKVIT)/usr/lib diff --git a/projects/bittboy_rules b/projects/bittboy_rules new file mode 100644 index 00000000..dd5a6b0c --- /dev/null +++ b/projects/bittboy_rules @@ -0,0 +1,9 @@ +-include $(PWD)/base_rules + +#STRIP = arm-linux-strip +STRIP = ls + +#--------------------------------------------------------------------------------- +%.elf: $(OFILES) + $(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) + @$(STRIP) $@ diff --git a/projects/rs97_rules b/projects/rs97_rules new file mode 100644 index 00000000..91be76fa --- /dev/null +++ b/projects/rs97_rules @@ -0,0 +1,9 @@ +-include $(PWD)/base_rules + +#STRIP = mipsel-linux-strip +STRIP = ls + +#--------------------------------------------------------------------------------- +%.dge: $(OFILES) + $(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) + @$(STRIP) $@ diff --git a/sources/Adapters/DINGOO/Midi/DINGOOMidiService.cpp b/sources/Adapters/DINGOO/Midi/DINGOOMidiService.cpp index 14a5476c..4e4f9f46 100644 --- a/sources/Adapters/DINGOO/Midi/DINGOOMidiService.cpp +++ b/sources/Adapters/DINGOO/Midi/DINGOOMidiService.cpp @@ -1,7 +1,7 @@ #include "DINGOOMidiService.h" #include "DINGOOSerialMidiDevice.h" -#include "System/io/Trace.h" +//#include "System/io/Trace.h" DINGOOMidiService::DINGOOMidiService() { } ; diff --git a/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp b/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp index a9a03b2b..fbfd4694 100644 --- a/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp +++ b/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp @@ -1,19 +1,27 @@ #include "DINGOOSerialMidiDevice.h" -#include "System/io/Trace.h" +//#include "System/io/Trace.h" #include #include #include -#include +#include #include #include -const char *port="/dev/ttyS0" ; -//const char *port="/dev/usb/tts/0" ; -#define BAUDRATE B38400 +#ifdef USB_TTY +const char *port="/dev/usb/tts/0" ; +#else +const char *port="/dev/ttyS1" ; +#endif +//#define BAUDRATE B38400 +#define BAUDRATE B57600 +#ifdef RS97 +DINGOOSerialMidiDevice::DINGOOSerialMidiDevice():MidiOutDevice("RS-97 Serial") { +#else DINGOOSerialMidiDevice::DINGOOSerialMidiDevice():MidiOutDevice("DINGOO Serial") { +#endif fd_=0 ; } ; @@ -21,10 +29,11 @@ bool DINGOOSerialMidiDevice::Init(){ struct termios newtio; - Trace::Debug("about to open port") ; + printf("about to open port\n") ; fd_ = open(port, O_RDWR /*| O_NOCTTY | O_NDELAY*/ ); - if (fd_ <=0) {Trace::Dump("Failed to open %",port); fd_=0 ;return false ; } - Trace::Dump("opened serial successfully %x",fd_) ; + if (fd_ <=0) {printf("Failed to open %s",port); fd_=0 ;return false ; } + //Trace::Dump("opened serial successfully %x",fd_) ; + printf("opened serial successfully"); tcgetattr(fd_,&oldtio_); /* save current port settings */ memset(&newtio,0,sizeof(newtio)) ; @@ -40,9 +49,9 @@ bool DINGOOSerialMidiDevice::Init(){ tcflush(fd_, TCIFLUSH); int code=tcsetattr(fd_,TCSANOW,&newtio); if (code<0) { - Trace::Dump("Failed to set attributes") ; + printf("Failed to set attributes\n") ; } else { - Trace::Debug("Serial attributes set") ; + printf("Serial attributes set\n") ; } return (code>=0) ; @@ -77,7 +86,7 @@ void DINGOOSerialMidiDevice::SendMessage(MidiMessage &msg) { len=3 ; } write(fd_,buffer,len); - Trace::Debug("Sending 0x%x 0x%x 0x%x",buffer[0],buffer[1],buffer[2]) ; + printf("Sending 0x%x 0x%x 0x%x\n",buffer[0],buffer[1],buffer[2]) ; } } ; diff --git a/sources/Adapters/DINGOO/System/DINGOOSystem.cpp b/sources/Adapters/DINGOO/System/DINGOOSystem.cpp index 30a7fbf5..b17a3c7f 100644 --- a/sources/Adapters/DINGOO/System/DINGOOSystem.cpp +++ b/sources/Adapters/DINGOO/System/DINGOOSystem.cpp @@ -5,7 +5,7 @@ #include "Adapters/SDL/GUI/SDLEventManager.h" #include "Adapters/SDL/Process/SDLProcess.h" #include "Adapters/DINGOO/Audio/DINGOOAudio.h" -#include "Adapters/Dummy/Midi/DummyMidi.h" +#include "Adapters/DINGOO/Midi/DINGOOMidiService.h" #include "Externals/TinyXML/tinyxml.h" #include "Application/Model/Config.h" #include "Application/Controllers/ControlRoom.h" @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include EventManager *GPSDLSystem::eventManager_ = NULL ; bool GPSDLSystem::invert_=false ; @@ -76,7 +79,7 @@ void GPSDLSystem::Boot(int argc,char **argv) { Audio::Install(new DINGOOAudio(hint)) ; // Install Midi - MidiService::Install(new DummyMidi()) ; + MidiService::Install(new DINGOOMidiService()) ; // Install Threads @@ -200,6 +203,11 @@ void GPSDLSystem::PostQuitMessage() unsigned int GPSDLSystem::GetMemoryUsage() { - struct mallinfo m=mallinfo(); - return m.uordblks ; +#ifdef RS97 + return 1000000; +#else + struct mallinfo mi; + mi = mallinfo(); + return mi.uordblks ; +#endif } diff --git a/sources/Adapters/SDL/GUI/SDLGUIWindowImp.cpp b/sources/Adapters/SDL/GUI/SDLGUIWindowImp.cpp index 76bfcb0b..b2874798 100644 --- a/sources/Adapters/SDL/GUI/SDLGUIWindowImp.cpp +++ b/sources/Adapters/SDL/GUI/SDLGUIWindowImp.cpp @@ -70,11 +70,21 @@ SDLGUIWindowImp::SDLGUIWindowImp(GUICreateWindowParams &p) int screenWidth = 480; int screenHeight = 272; windowed_ = false; + #elif defined(RS97) + int screenWidth = 320; + int screenHeight = 240; + windowed_ = false; #else int screenWidth = videoInfo->current_w; int screenHeight = videoInfo->current_h; #endif + + #if defined(RS97) + /* Pick the best bitdepth for the RS97 as it will select 32 as its default, even though that's slow */ + bitDepth_ = 16; + #else bitDepth_ = videoInfo->vfmt->BitsPerPixel; + #endif char driverName[64] ; SDL_VideoDriverName(driverName,64); diff --git a/sources/Adapters/SDL/Input/SDLInput.cpp b/sources/Adapters/SDL/Input/SDLInput.cpp index 2bb0ebee..f1bd294f 100644 --- a/sources/Adapters/SDL/Input/SDLInput.cpp +++ b/sources/Adapters/SDL/Input/SDLInput.cpp @@ -2,7 +2,7 @@ #include "SDLInput.h" #include "Application/Model/Config.h" - +/* int keyMapping[]={ SDLK_a, SDLK_s, @@ -14,6 +14,19 @@ int keyMapping[]={ SDLK_LCTRL, SDLK_SPACE } ; +*/ + +int keyMapping[]={ + SDLK_LCTRL, + SDLK_LALT, + SDLK_LEFT, + SDLK_RIGHT, + SDLK_UP, + SDLK_DOWN, + SDLK_SPACE, + SDLK_LSHIFT, + SDLK_RETURN +} ; int eventMapping[]={ SDLI_BUTTON_A,