OPENDINGUX: Separate miyoo from opendingux

This commit is contained in:
Vladimir Serbinenko 2023-01-16 19:43:51 +01:00
parent 977a47ad76
commit de6fa88217
11 changed files with 326 additions and 32 deletions

View file

@ -0,0 +1,28 @@
[ScummVM-Miyoo README]
Controls
========
Dpad - Mouse
Dpad+R - Slow Mouse
A - Left mouse click
B - Right mouse click
X - Escape
X+R - Return
Y - Period
Y+R - Space
L - Game Menu (F5)
R - Shift
Start - Global Menu
Select - Virtual Keyboard
Select+R - AGI predictive input dialog
D-pad - Keypad cursor keys
D-Pad+R - Diagonal cursor keys
Troubleshooting
===============
In case you need to submit a bugreport, you may find the log file at the
following path:
SDCARD/.scummvm/scummvm.log
The log file is being overwritten at every ScummVM run.

View file

@ -0,0 +1,45 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#include "backends/platform/sdl/miyoo/miyoo.h"
#include "backends/plugins/sdl/sdl-provider.h"
#include "base/main.h"
int main(int argc, char* argv[]) {
g_system = new OSystem_SDL_Miyoo();
assert(g_system);
g_system->init();
#ifdef DYNAMIC_MODULES
PluginManager::instance().addPluginProvider(new SDLPluginProvider());
#endif
// Invoke the actual ScummVM main entry point:
int res = scummvm_main(argc, argv);
// Free OSystem
g_system->destroy();
return res;
}

View file

@ -0,0 +1,195 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#define FORBIDDEN_SYMBOL_EXCEPTION_system
#include "common/scummsys.h"
#include "common/config-manager.h"
#include "common/translation.h"
#include "backends/platform/sdl/miyoo/miyoo.h"
#include "backends/fs/posix/posix-fs-factory.h"
#include "backends/fs/posix/posix-fs.h"
#include "backends/saves/default/default-saves.h"
#include "backends/keymapper/action.h"
#include "backends/keymapper/keymapper-defaults.h"
#include "backends/keymapper/hardware-input.h"
#include "backends/keymapper/keymap.h"
#include "backends/keymapper/keymapper.h"
#define SCUMM_DIR "/mnt/.scummvm"
#define CONFIG_FILE "/mnt/.scummvmrc"
#define SAVE_PATH "/mnt/.scummvm/saves"
#define LOG_FILE "/mnt/.scummvm/scummvm.log"
#define JOYSTICK_DIR "/sys/devices/platform/joystick"
static const Common::KeyTableEntry odKeyboardButtons[] = {
{ "JOY_A", Common::KEYCODE_LALT, _s("A") },
{ "JOY_B", Common::KEYCODE_LCTRL, _s("B") },
{ "JOY_X", Common::KEYCODE_LSHIFT, _s("X") },
{ "JOY_Y", Common::KEYCODE_SPACE, _s("Y") },
{ "JOY_BACK", Common::KEYCODE_ESCAPE, _s("Select") },
{ "JOY_START", Common::KEYCODE_RETURN, _s("Start") },
{ "JOY_LEFT_SHOULDER", Common::KEYCODE_TAB, _s("L") },
{ "JOY_RIGHT_SHOULDER", Common::KEYCODE_BACKSPACE, _s("R") },
{ "JOY_UP", Common::KEYCODE_UP, _s("D-pad Up") },
{ "JOY_DOWN", Common::KEYCODE_DOWN, _s("D-pad Down") },
{ "JOY_LEFT", Common::KEYCODE_LEFT, _s("D-pad Left") },
{ "JOY_RIGHT", Common::KEYCODE_RIGHT, _s("D-pad Right") },
{ "JOY_LEFT_STICK", Common::KEYCODE_PAGEUP, _s("L2") },
{ "JOY_RIGHT_STICK", Common::KEYCODE_PAGEDOWN, _s("R2") },
{ "JOY_LEFT_TRIGGER", Common::KEYCODE_RALT, _s("L3") },
{ "JOY_RIGHT_TRIGGER", Common::KEYCODE_RSHIFT, _s("R3") },
{ "JOY_GUIDE", Common::KEYCODE_RCTRL, _s("Menu") },
{nullptr, Common::KEYCODE_INVALID, nullptr }
};
static const Common::HardwareInputTableEntry odJoystickButtons[] = {
{ "JOY_LEFT_TRIGGER", Common::JOYSTICK_BUTTON_LEFT_STICK, _s("L3") },
{ nullptr, 0, nullptr }
};
static const Common::AxisTableEntry odJoystickAxes[] = {
{ "JOY_LEFT_STICK_X", Common::JOYSTICK_AXIS_LEFT_STICK_X, Common::kAxisTypeFull, _s("Left Stick X") },
{ "JOY_LEFT_STICK_Y", Common::JOYSTICK_AXIS_LEFT_STICK_Y, Common::kAxisTypeFull, _s("Left Stick Y") },
{ nullptr, 0, Common::kAxisTypeFull, nullptr }
};
Common::KeymapperDefaultBindings *OSystem_SDL_Miyoo::getKeymapperDefaultBindings() {
Common::KeymapperDefaultBindings *keymapperDefaultBindings = new Common::KeymapperDefaultBindings();
if (!Posix::assureDirectoryExists(JOYSTICK_DIR)) {
keymapperDefaultBindings->setDefaultBinding(Common::kGlobalKeymapName, "VMOUSEUP", "JOY_UP");
keymapperDefaultBindings->setDefaultBinding(Common::kGlobalKeymapName, "VMOUSEDOWN", "JOY_DOWN");
keymapperDefaultBindings->setDefaultBinding(Common::kGlobalKeymapName, "VMOUSELEFT", "JOY_LEFT");
keymapperDefaultBindings->setDefaultBinding(Common::kGlobalKeymapName, "VMOUSERIGHT", "JOY_RIGHT");
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, "UP", "");
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, "DOWN", "");
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, "LEFT", "");
keymapperDefaultBindings->setDefaultBinding(Common::kGuiKeymapName, "RIGHT", "");
keymapperDefaultBindings->setDefaultBinding("engine-default", "UP", "");
keymapperDefaultBindings->setDefaultBinding("engine-default", "DOWN", "");
keymapperDefaultBindings->setDefaultBinding("engine-default", "LEFT", "");
keymapperDefaultBindings->setDefaultBinding("engine-default", "RIGHT", "");
}
return keymapperDefaultBindings;
}
void OSystem_SDL_Miyoo::init() {
_fsFactory = new POSIXFilesystemFactory();
if (!Posix::assureDirectoryExists(SCUMM_DIR)) {
system("mkdir " SCUMM_DIR);
}
// Invoke parent implementation of this method
OSystem_SDL::init();
}
void OSystem_SDL_Miyoo::initBackend() {
ConfMan.registerDefault("fullscreen", true);
ConfMan.registerDefault("aspect_ratio", true);
ConfMan.registerDefault("themepath", "./themes");
ConfMan.registerDefault("extrapath", "./engine-data");
ConfMan.registerDefault("gui_theme", "builtin");
ConfMan.registerDefault("scale_factor", "1");
ConfMan.setBool("fullscreen", true);
ConfMan.setInt("joystick_num", 0);
if (!ConfMan.hasKey("aspect_ratio")) {
ConfMan.setBool("aspect_ratio", true);
}
if (!ConfMan.hasKey("themepath")) {
ConfMan.set("themepath", "./themes");
}
if (!ConfMan.hasKey("extrapath")) {
ConfMan.set("extrapath", "./engine-data");
}
if (!ConfMan.hasKey("savepath")) {
ConfMan.set("savepath", SAVE_PATH);
}
if (!ConfMan.hasKey("gui_theme")) {
ConfMan.set("gui_theme", "builtin");
}
if (!ConfMan.hasKey("scale_factor")) {
ConfMan.set("scale_factor", "1");
}
if (!ConfMan.hasKey("opl_driver")) {
ConfMan.set("opl_driver", "db");
}
if (!ConfMan.hasKey("kbdmouse_speed")) {
ConfMan.setInt("kbdmouse_speed", 2);
}
// Create the savefile manager
if (_savefileManager == nullptr) {
_savefileManager = new DefaultSaveFileManager(SAVE_PATH);
}
OSystem_SDL::initBackend();
}
Common::String OSystem_SDL_Miyoo::getDefaultConfigFileName() {
return CONFIG_FILE;
}
Common::String OSystem_SDL_Miyoo::getDefaultLogFileName() {
return LOG_FILE;
}
bool OSystem_SDL_Miyoo::hasFeature(Feature f) {
switch (f) {
case kFeatureFullscreenMode:
case kFeatureAspectRatioCorrection:
return false;
case kFeatureKbdMouseSpeed:
return true;
default:
return OSystem_SDL::hasFeature(f);
}
}
void OSystem_SDL_Miyoo::setFeatureState(Feature f, bool enable) {
OSystem_SDL::setFeatureState(f, enable);
}
bool OSystem_SDL_Miyoo::getFeatureState(Feature f) {
return OSystem_SDL::getFeatureState(f);
}
Common::HardwareInputSet *OSystem_SDL_Miyoo::getHardwareInputSet() {
using namespace Common;
CompositeHardwareInputSet *inputSet = new CompositeHardwareInputSet();
// Users may use USB mice - keyboards currently not possible with SDL1 as it conflicts with gpios
inputSet->addHardwareInputSet(new MouseHardwareInputSet(defaultMouseButtons));
//inputSet->addHardwareInputSet(new KeyboardHardwareInputSet(defaultKeys, defaultModifiers));
inputSet->addHardwareInputSet(new KeyboardHardwareInputSet(odKeyboardButtons, defaultModifiers));
inputSet->addHardwareInputSet(new JoystickHardwareInputSet(odJoystickButtons, odJoystickAxes));
return inputSet;
}

View file

@ -0,0 +1,42 @@
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef PLATFORM_SDL_MIYOO_H
#define PLATFORM_SDL_MIYOO_H
#include "backends/platform/sdl/sdl.h"
class OSystem_SDL_Miyoo : public OSystem_SDL {
public:
void init() override;
void initBackend() override;
bool hasFeature(Feature f) override;
void setFeatureState(Feature f, bool enable) override;
bool getFeatureState(Feature f) override;
Common::HardwareInputSet *getHardwareInputSet() override;
Common::KeymapperDefaultBindings *getKeymapperDefaultBindings() override;
protected:
Common::String getDefaultConfigFileName() override;
Common::String getDefaultLogFileName() override;
};
#endif

View file

@ -30,17 +30,16 @@ ifdef DYNAMIC_MODULES
$(CP) $(PLUGINS) $(bundle)/$(G2X_CATEGORY)/scummvm/plugins/
endif
$(CP) $(EXECUTABLE) $(bundle)/$(G2X_CATEGORY)/scummvm/scummvm
$(CP) $(srcdir)/dists/opendingux/scummvm.png $(bundle)/$(G2X_CATEGORY)/scummvm
$(CP) $(srcdir)/backends/platform/sdl/opendingux/README.OPENDINGUX $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
$(CP) $(srcdir)/backends/platform/sdl/miyoo/README.MIYOO $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
echo >> $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
echo '[General README]' >> $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
echo >> $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
cat $(srcdir)/README.md | sed -e 's/\[/⟦/g' -e 's/\]/⟧/g' -e '/^1\.1)/,$$ s/^[0-9][0-9]*\.[0-9][0-9]*.*/\[&\]/' >> $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
echo '[General README]' >> $(bundle)/$(G2X_CATEGORY)/scummvm/README.man.txt
$(MKDIR) -p $(bundle)/gmenu2x/sections/$(G2X_CATEGORY)
$(CP) $(srcdir)/dists/opendingux/scummvm.miyoo $(bundle)/gmenu2x/sections/$(G2X_CATEGORY)/scummvm
$(CP) $(srcdir)/dists/miyoo/scummvm.miyoo $(bundle)/gmenu2x/sections/$(G2X_CATEGORY)/scummvm
$(STRIP) $(bundle)/$(G2X_CATEGORY)/scummvm/scummvm
sd-zip: $(bundle)
$(RM) scummvm_$(OPENDINGUX_TARGET).zip
cd $(bundle) && zip -r ../scummvm_$(OPENDINGUX_TARGET).zip $(G2X_CATEGORY) gmenu2x
$(RM) scummvm_$(MIYOO_TARGET).zip
cd $(bundle) && zip -r ../scummvm_$(MIYOO_TARGET).zip $(G2X_CATEGORY) gmenu2x

View file

@ -41,6 +41,12 @@ MODULE_OBJS += \
riscos/riscos.o
endif
ifdef MIYOO
MODULE_OBJS += \
miyoo/miyoo-main.o \
miyoo/miyoo.o
endif
ifdef MORPHOS
MODULE_OBJS += \
morphos/morphos-main.o \

View file

@ -37,31 +37,17 @@
#include "backends/keymapper/keymap.h"
#include "backends/keymapper/keymapper.h"
#ifdef MIYOO
#define SCUMM_DIR "/mnt/.scummvm"
#define CONFIG_FILE "/mnt/.scummvmrc"
#define SAVE_PATH "/mnt/.scummvm/saves"
#define LOG_FILE "/mnt/.scummvm/scummvm.log"
#else
#define SCUMM_DIR "~/.scummvm"
#define CONFIG_FILE "~/.scummvmrc"
#define SAVE_PATH "~/.scummvm/saves"
#define LOG_FILE "~/.scummvm/scummvm.log"
#endif
#define JOYSTICK_DIR "/sys/devices/platform/joystick"
static const Common::KeyTableEntry odKeyboardButtons[] = {
#ifdef MIYOO
{ "JOY_A", Common::KEYCODE_LALT, _s("A") },
{ "JOY_B", Common::KEYCODE_LCTRL, _s("B") },
{ "JOY_X", Common::KEYCODE_LSHIFT, _s("X") },
{ "JOY_Y", Common::KEYCODE_SPACE, _s("Y") },
#else
{ "JOY_A", Common::KEYCODE_LCTRL, _s("A") },
{ "JOY_B", Common::KEYCODE_LALT, _s("B") },
{ "JOY_X", Common::KEYCODE_SPACE, _s("X") },
{ "JOY_Y", Common::KEYCODE_LSHIFT, _s("Y") },
#endif
{ "JOY_BACK", Common::KEYCODE_ESCAPE, _s("Select") },
{ "JOY_START", Common::KEYCODE_RETURN, _s("Start") },
{ "JOY_LEFT_SHOULDER", Common::KEYCODE_TAB, _s("L") },
@ -70,13 +56,6 @@ static const Common::KeyTableEntry odKeyboardButtons[] = {
{ "JOY_DOWN", Common::KEYCODE_DOWN, _s("D-pad Down") },
{ "JOY_LEFT", Common::KEYCODE_LEFT, _s("D-pad Left") },
{ "JOY_RIGHT", Common::KEYCODE_RIGHT, _s("D-pad Right") },
#ifdef MIYOO
{ "JOY_LEFT_STICK", Common::KEYCODE_PAGEUP, _s("L2") },
{ "JOY_RIGHT_STICK", Common::KEYCODE_PAGEDOWN, _s("R2") },
{ "JOY_LEFT_TRIGGER", Common::KEYCODE_RALT, _s("L3") },
{ "JOY_RIGHT_TRIGGER", Common::KEYCODE_RSHIFT, _s("R3") },
{ "JOY_GUIDE", Common::KEYCODE_RCTRL, _s("Menu") },
#endif
{nullptr, Common::KEYCODE_INVALID, nullptr }
};

View file

@ -21,7 +21,7 @@
#include "common/scummsys.h"
#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(NINTENDO_SWITCH) && !defined(__EMSCRIPTEN__)
#if defined(POSIX) && !defined(MACOSX) && !defined(SAMSUNGTV) && !defined(MAEMO) && !defined(GPH_DEVICE) && !defined(GP2X) && !defined(DINGUX) && !defined(OPENPANDORA) && !defined(PLAYSTATION3) && !defined(PSP2) && !defined(NINTENDO_SWITCH) && !defined(__EMSCRIPTEN__) && !defined(MIYOO)
#include "backends/platform/sdl/posix/posix.h"
#include "backends/plugins/sdl/sdl-provider.h"

10
configure vendored
View file

@ -3519,7 +3519,7 @@ if test -n "$_host"; then
miyoo)
_sysroot=`$CXX --print-sysroot`
_sdlpath=$_sysroot/usr/bin
append_var DEFINES "-DMIYOO -DREDUCE_MEMORY_USAGE -DDINGUX -DOPENDINGUX -DUNCACHED_PLUGINS"
append_var DEFINES "-DMIYOO -DREDUCE_MEMORY_USAGE -DUNCACHED_PLUGINS"
append_var CXXFLAGS "-march=armv5te -mtune=arm926ej-s -ffast-math -fomit-frame-pointer -ffunction-sections -fdata-sections"
append_var LDFLAGS "-march=armv5te -mtune=arm926ej-s -ffast-math -fomit-frame-pointer -ffunction-sections -fdata-sections"
append_var LDFLAGS "-O3 -Wl,--as-needed,--gc-sections"
@ -3538,10 +3538,10 @@ if test -n "$_host"; then
_nuked_opl=no
_curl=no
_optimization_level=-O3
_backend="opendingux"
_port_mk="backends/platform/sdl/opendingux/miyoo.mk"
add_line_to_config_mk 'OPENDINGUX = 1'
add_line_to_config_mk "OPENDINGUX_TARGET = miyoo"
_backend="miyoo"
_port_mk="backends/platform/sdl/miyoo/miyoo.mk"
add_line_to_config_mk 'MIYOO = 1'
add_line_to_config_mk "MIYOO_TARGET = miyoo"
;;
n64)
append_var CXXFLAGS "-mno-extern-sdata"