From 47d0fdbcac8040fa193fd5277f10c3ffe8e280f7 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Sat, 14 Jul 2018 11:54:28 -0400 Subject: [PATCH 1/5] Add support for the RS97 --- .gitignore | 2 +- projects/BUILD_HOW_TO.txt | 2 ++ projects/Makefile | 30 +++++++++++++++++++ projects/Makefile.RS97 | 19 ++++++++++++ projects/rs97_rules | 9 ++++++ .../DINGOO/Midi/DINGOOMidiService.cpp | 2 +- .../DINGOO/Midi/DINGOOSerialMidiDevice.cpp | 22 ++++++++------ .../Adapters/DINGOO/System/DINGOOSystem.cpp | 16 +++++++--- sources/Adapters/SDL/GUI/SDLGUIWindowImp.cpp | 10 +++++++ 9 files changed, 97 insertions(+), 15 deletions(-) create mode 100644 projects/Makefile.RS97 create mode 100644 projects/rs97_rules 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..73a805bd 100644 --- a/projects/BUILD_HOW_TO.txt +++ b/projects/BUILD_HOW_TO.txt @@ -9,3 +9,5 @@ GP2X: Compile under minsys PSP: Compile under minsys DINGOO: Compile under Linux + +RS97: Compile under Linux and type make PLATFORM=RS97 diff --git a/projects/Makefile b/projects/Makefile index 59768b2b..8ce69107 100644 --- a/projects/Makefile +++ b/projects/Makefile @@ -115,6 +115,19 @@ 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 + PSPDIRS := . \ ../sources/Adapters/PSP/Main \ ../sources/Adapters/PSP/FileSystem \ @@ -199,6 +212,23 @@ 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 + PSPFILES := PSPmain.o \ PSPFileSystem.o \ Process.o \ diff --git a/projects/Makefile.RS97 b/projects/Makefile.RS97 new file mode 100644 index 00000000..0a638e2f --- /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-uclibc/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 + +CXXFLAGS:= $(CFLAGS) -fpermissive -std=gnu++03 + +EXTENSION:= dge + +LIBS := -lSDL -lpthread +LIBDIRS := $(DEKVIT)/usr/lib 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..4fc5ab9f 100644 --- a/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp +++ b/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp @@ -1,10 +1,10 @@ #include "DINGOOSerialMidiDevice.h" -#include "System/io/Trace.h" +//#include "System/io/Trace.h" #include #include #include -#include +#include #include #include @@ -12,8 +12,11 @@ const char *port="/dev/ttyS0" ; //const char *port="/dev/usb/tts/0" ; #define BAUDRATE B38400 - +#ifdef RS97 +DINGOOSerialMidiDevice::DINGOOSerialMidiDevice():MidiOutDevice("RS-97 Serial") { +#else DINGOOSerialMidiDevice::DINGOOSerialMidiDevice():MidiOutDevice("DINGOO Serial") { +#endif fd_=0 ; } ; @@ -21,10 +24,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 +44,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 +81,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); From 7cdd37b8f89a3aa0a5a60d5967396dc4fa84e684 Mon Sep 17 00:00:00 2001 From: gameblabla Date: Mon, 25 Mar 2019 00:17:04 +0100 Subject: [PATCH 2/5] Allow it to be built with support for USB serial. --- projects/Makefile.RS97 | 4 ++-- .../Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp | 11 ++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/projects/Makefile.RS97 b/projects/Makefile.RS97 index 0a638e2f..1aa525f2 100644 --- a/projects/Makefile.RS97 +++ b/projects/Makefile.RS97 @@ -5,11 +5,11 @@ TARGET = lgpt.dge TOOLPATH=$(DEVKIT)/usr/bin PREFIX := mipsel-linux- -SDL_BASE = /opt/rs97-toolchain/usr/mipsel-buildroot-linux-uclibc/sysroot/usr/bin/ +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 +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 diff --git a/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp b/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp index 4fc5ab9f..fbfd4694 100644 --- a/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp +++ b/sources/Adapters/DINGOO/Midi/DINGOOSerialMidiDevice.cpp @@ -8,9 +8,14 @@ #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") { From 33ad0a8af3ddbfd49f25ccde1dbec0f20647eb9a Mon Sep 17 00:00:00 2001 From: gameblabla Date: Fri, 5 Jul 2019 00:18:04 +0200 Subject: [PATCH 3/5] Bittboy port. --- projects/Makefile | 30 +++++++++++++++++++++++++ projects/Makefile.BITTBOY | 19 ++++++++++++++++ projects/bittboy_rules | 9 ++++++++ sources/Adapters/SDL/Input/SDLInput.cpp | 15 ++++++++++++- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 projects/Makefile.BITTBOY create mode 100644 projects/bittboy_rules diff --git a/projects/Makefile b/projects/Makefile index 8ce69107..a28adc0b 100644 --- a/projects/Makefile +++ b/projects/Makefile @@ -127,6 +127,19 @@ RS97DIRS := . \ ../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 \ @@ -228,6 +241,23 @@ RS97FILES := GPSDLMain.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 \ diff --git a/projects/Makefile.BITTBOY b/projects/Makefile.BITTBOY new file mode 100644 index 00000000..0f5ace2a --- /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)/rs97_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:= dge + +LIBS := -lSDL -lasound -lpthread +LIBDIRS := $(DEKVIT)/usr/lib diff --git a/projects/bittboy_rules b/projects/bittboy_rules new file mode 100644 index 00000000..8edd4c9d --- /dev/null +++ b/projects/bittboy_rules @@ -0,0 +1,9 @@ +-include $(PWD)/base_rules + +#STRIP = arm-linux-strip +STRIP = ls + +#--------------------------------------------------------------------------------- +%.dge: $(OFILES) + $(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) + @$(STRIP) $@ 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, From f9c0405bb190834be78779aff479e2adbee85f74 Mon Sep 17 00:00:00 2001 From: David DeGraw Date: Sat, 13 Jul 2019 14:32:15 -0600 Subject: [PATCH 4/5] Correct bittboy makefile --- projects/Makefile.BITTBOY | 4 ++-- projects/bittboy_rules | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/projects/Makefile.BITTBOY b/projects/Makefile.BITTBOY index 0f5ace2a..ab201985 100644 --- a/projects/Makefile.BITTBOY +++ b/projects/Makefile.BITTBOY @@ -7,13 +7,13 @@ TOOLPATH=$(DEVKIT)/usr/bin PREFIX := arm-linux- SDL_BASE = /opt/bittboy-toolchain/usr/arm-miyoo-linux-musleabi/sysroot/usr/bin/ -include $(PWD)/rs97_rules +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:= dge +EXTENSION:= elf LIBS := -lSDL -lasound -lpthread LIBDIRS := $(DEKVIT)/usr/lib diff --git a/projects/bittboy_rules b/projects/bittboy_rules index 8edd4c9d..dd5a6b0c 100644 --- a/projects/bittboy_rules +++ b/projects/bittboy_rules @@ -4,6 +4,6 @@ STRIP = ls #--------------------------------------------------------------------------------- -%.dge: $(OFILES) +%.elf: $(OFILES) $(CXX) $(LDFLAGS) -o $@ $(OFILES) $(LIBS) @$(STRIP) $@ From 966212d61963f281ca0f4bcb59b77036d922f48e Mon Sep 17 00:00:00 2001 From: David DeGraw Date: Sat, 13 Jul 2019 15:04:09 -0600 Subject: [PATCH 5/5] Add note on how to build for bittboy --- projects/BUILD_HOW_TO.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/projects/BUILD_HOW_TO.txt b/projects/BUILD_HOW_TO.txt index 73a805bd..606b6b67 100644 --- a/projects/BUILD_HOW_TO.txt +++ b/projects/BUILD_HOW_TO.txt @@ -11,3 +11,5 @@ 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